@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-rise-direction: 1;
  --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: var(--bg);
}

/* 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 4s 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 and the dimming rule
   below, and adding the matching HTML ids. Hovering a row calls goTo()
   in js/insta-carousel.js (same as a click), which sets .is-active — so
   this is the only reveal rule; there's no separate :hover-driven version
   to keep in sync, which used to let hover and the auto-advance timer
   show two hero images at once. */
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-google.is-active) #hover-bg-google,
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.05);
  }
}

.site-header,
.project-footer {
  flex: none;
  display: flex;
  align-items: center;
  padding-block: 24px;
  padding-inline: var(--grid-margin);
  font-size: var(--row-size);
}

.site-header {
  justify-content: space-between;
}

.project-footer {
  justify-content: center;
}

.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 one row is active (auto-advance, click, or
   hover — hover calls goTo() in js/insta-carousel.js, same as a click),
   so the reveal reads as the focused one. */
.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-google.is-active) .project-row:not(#row-google),
.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 — each project row rises in, staggered by
   row. The wordmark and "P.(O)" header are already in their final state
   on load, no animation. Scoped to body.home since .project-row is shared
   markup/classes used (unanimated) on every other page.
   ---------------------------------------------------------------------- */

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(calc(var(--motion-rise-distance) * var(--motion-rise-direction, 1)));
  }

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

/* 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.
   --motion-rise-direction: -1 makes rows drop down into place instead of
   the default rise-up (--row-index, set inline per row in index.html,
   staggers each row's start by 0.05s). */
body.home .project-row {
  --motion-rise-direction: -1;
  animation: rise-in var(--motion-duration) ease backwards;
  animation-delay: calc(0.15s + var(--row-index, 0) * 0.05s);
}

/* ----------------------------------------------------------------------
   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);
  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;
}

#grid-toggle {
  margin-right: var(--grid-margin);
}

.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. Runs on
   both desktop and touch now — hovering the row list on desktop pauses the
   cycle and hands reveal control back to the plain :hover rules above. */
.auto-timer-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: transparent;
  z-index: 1;
}

/* Touch/mobile only: thinner bar than the desktop default. Zoom duration
   is the same 4s on both, set once above. */
@media (hover: none), (pointer: coarse) {
  .auto-timer-bar {
    height: 2.5px;
  }
}

/* First reveal of the auto-carousel only (see home-carousel.js) fades in
   instead of snapping straight to opacity:1 like every later switch. */
.hover-bg.is-first-reveal {
  transition: opacity 1s linear;
}

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

.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;
}

/* Per-line reveal (js/info-lines.js, GSAP SplitText + ScrollTrigger)
   sets each .line's opacity directly — no CSS state needed here. */

.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 the full width up to the page margin (matching the
   header/footer) rather than a fixed pixel width, so it scales with the
   page like everything else on the site. Centered both axes in the
   flex:1 space between the header and footer — .project-main's height
   is definite (it's a flex:1 child of the body flex column), so the
   frame's max-height:100% reliably caps it before it can ever overlap
   either bar, shrinking its width to match via aspect-ratio instead of
   overflowing. */
.project-main {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--grid-margin);
}

.project-frame {
  width: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 900 / 510;
}

/* 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
   ---------------------------------------------------------------------- */

/* Nav logo always reads the short "P. ( O )" form, on every page, at any
   width — same component and content everywhere. */
.header-text-full {
  display: none;
}

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

@media (max-width: 767px) {
  /* The center homepage wordmark (.wordmark-text) is a different piece of
     copy from the nav logo — it spells "PATTERN" out in full on desktop,
     so its own short form needs its own mobile sizing. */
  .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: var(--fg);
  }
}

/* ----------------------------------------------------------------------
   Bar prototype (bar.html) — hovered row fills white with dark text
   instead of just dimming its neighbors. Same markup/ids as index.html,
   so the existing hero reveal/dim rules above still apply underneath.
   ---------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  body.bar-page .project-row:hover {
    background: #fff;
    color: var(--bg);
  }
}

body.bar-page .project-row.is-active {
  background: #fff;
  color: var(--bg);
}

/* ----------------------------------------------------------------------
   Homepage entrance (index.html) — wordmark cycles through words for
   "office" before settling (see js/wordmark-intro.js), then rows reveal,
   then the hero carousel begins. Smaller/fluid font-size than the base
   .wordmark-text, which is tuned for the short "P. (O)" form and is too
   wide for "PATTERN (OFFICINE)".
   ---------------------------------------------------------------------- */
.home-intro-wordmark {
  font-size: clamp(22px, 4.5vw, 48px);
  letter-spacing: 0.08em;
}

/* Rows stay hidden until the wordmark cycle finishes and
   js/wordmark-intro.js adds .row-animate to each one in turn, staggered —
   no transition here, so each row snaps straight to opacity:1 instantly
   at its staggered moment instead of fading in. */
.home-intro .project-row:not(.row-animate) {
  opacity: 0;
}

.home-intro .project-row.row-animate {
  opacity: 1;
}

/* ----------------------------------------------------------------------
   Instagram-Stories-style segmented progress bar: base styles are the
   top-pinned default (used by the insta-top.html prototype); the homepage
   (index.html) and insta-top.html both tap the right/left half of the
   screen to advance/go back (js/insta-carousel.js drives both).
   ---------------------------------------------------------------------- */
.insta-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 4px;
  padding: 10.5px var(--grid-margin) 0;
  z-index: 2;
  opacity: 0;
}

/* Added by js/insta-carousel.js the instant the first hero image reveals
   (same goTo call that sets .is-active) — no transition, snaps in sync
   with the hero image's own instant opacity snap. */
.insta-progress.is-visible {
  opacity: 1;
}

/* insta-top.html: gap above and below the stepper doubled to 21px each
   (was 10.5px, halfway-centered in the default 24px nav offset); nav
   pushed down to 45px (21 + 3px bar + 21) to keep the bottom gap equal. */
.insta-top .insta-progress {
  padding-top: 21px;
}

.insta-top .site-header {
  padding-top: 45px;
}

.insta-segment {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.insta-segment-fill {
  height: 100%;
  width: 0%;
  background: #fff;
}

/* Bottom-pinned variant of the segmented bar — this is the live homepage
   (index.html): tap right/left half of the screen to advance/go back
   (js/insta-carousel.js), bar pinned to the bottom instead of the top. */
.insta-bottom .insta-progress {
  top: auto;
  bottom: 0;
  padding: 0 var(--grid-margin) 12px;
}

.insta-bottom .site-header {
  padding-top: 24px;
}

/* ----------------------------------------------------------------------
   Gyroscope prototype (gyroscope.html) — tilt-driven row reveal, kept off
   the main site pages.
   ---------------------------------------------------------------------- */
.gyroscope-enable {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.gyroscope-readout {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--grid-margin);
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  z-index: 1;
}

@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;
  }
}
