:root {
  color-scheme: light;
  --paper: #f7f7f4;
  --ink: #161616;
  --muted: #74746f;
  --line: #d8d8d2;
  --sidebar: 15.5rem;
  --pad: clamp(1.25rem, 3vw, 3rem);
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.45;
}

button, a { color: inherit; }

button { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 50%;
  transform: translate(-50%, -120%);
  padding: .65rem 1rem;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.skip-link:focus { transform: translate(-50%, 0); }

.sidebar {
  position: fixed;
  z-index: 5;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 3rem 2rem 2rem 3rem;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.wordmark {
  display: inline-flex;
  white-space: nowrap;
  font-size: 1.65rem;
  font-weight: 400;
  line-height: .86;
  letter-spacing: .08em;
  text-decoration: none;
}

.identity p {
  margin: 1.45rem 0 0;
  color: var(--muted);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: .82rem;
  line-height: 1.4;
}

.sidebar nav { margin-top: 6.5rem; }

.nav-label {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.project-link {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: .5rem;
  align-items: baseline;
  margin: 0 0 .7rem;
  color: var(--muted);
  font-size: .9rem;
  text-decoration: none;
  transition: color 180ms ease;
}

.project-link span { font-family: Georgia, 'Times New Roman', serif; font-size: .7rem; }
.project-link:hover, .project-link:focus-visible, .project-link.is-active { color: var(--ink); }

.sidebar-footer {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .06em;
}

.menu-toggle { display: none; }

main {
  min-height: 100vh;
  margin-left: var(--sidebar);
  padding: 2.8rem var(--pad) 4.5rem;
}

.project-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  max-width: 76rem;
  margin: 0 auto 2rem;
}

.eyebrow {
  margin: 0 0 .45rem;
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  font-weight: 400;
  line-height: .95;
}

.project-note {
  margin: 0 0 .25rem 2rem;
  color: var(--muted);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: .88rem;
}

.viewer { max-width: 76rem; margin: 0 auto; }

.mobile-gallery { display: none; }

.single-image .controls,
.single-image .stage-hit,
.single-image .index-section { display: none; }

.image-stage {
  position: relative;
  height: min(70vh, 49rem);
  min-height: 28rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #ecece7;
}

.image-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .035);
}

#main-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  opacity: 1;
  transition: opacity 220ms ease;
}

#main-image.is-changing { opacity: .15; }

.stage-hit {
  position: absolute;
  z-index: 2;
  inset-block: 0;
  width: 50%;
  border: 0;
  background: transparent;
}

.stage-hit--previous { left: 0; cursor: w-resize; }
.stage-hit--next { right: 0; cursor: e-resize; }

.viewer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 0 1.6rem;
  border-bottom: 1px solid var(--line);
  font-size: .75rem;
  letter-spacing: .08em;
}

.controls { display: flex; gap: .35rem; }
.controls button, #toggle-index {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.controls button:hover, .controls button:focus-visible, #toggle-index:hover, #toggle-index:focus-visible { opacity: .45; }

.index-section { max-width: 76rem; margin: 0 auto; padding-top: 1.7rem; }

.index-heading { display: flex; align-items: center; justify-content: space-between; }

.index-heading h2 {
  margin: 0;
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .13em;
  text-transform: uppercase;
}

#toggle-index { width: auto; min-height: 2rem; color: var(--muted); font-size: .75rem; }

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(.45rem, 1vw, .85rem);
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 700ms ease, opacity 300ms ease, margin 300ms ease;
}

.thumbnail-grid.is-open { max-height: 100rem; margin-top: 1rem; opacity: 1; }

.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #e9e9e3;
  cursor: pointer;
}

.thumb img { width: 100%; height: 100%; display: block; object-fit: cover; filter: saturate(.85); transition: transform 350ms ease, opacity 180ms ease; }
.thumb:hover img, .thumb:focus-visible img { transform: scale(1.025); }
.thumb.is-current img { opacity: .45; }

noscript { display: block; margin-left: var(--sidebar); padding: 1rem var(--pad); }

@media (max-width: 760px) {
  :root { --sidebar: 100%; }

  .menu-toggle {
    position: fixed;
    z-index: 10;
    top: 1rem;
    right: 1rem;
    width: 4.4rem;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 .75rem;
    border: 1px solid var(--line);
    background: rgba(247, 247, 244, .94);
    font-size: .72rem;
    cursor: pointer;
  }

  .sidebar {
    width: 100%;
    padding: 1.3rem 1.25rem 1.5rem;
    transform: translateY(-102%);
    transition: transform 320ms ease;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar.is-open { transform: translateY(0); }
  .sidebar nav { margin-top: 5rem; }
  .project-link { margin-bottom: 1rem; font-size: 1.1rem; }

  main { margin-left: 0; padding: 6.2rem 1rem 3rem; }

  .project-intro { grid-template-columns: 1fr; gap: .8rem; margin-bottom: 1.4rem; }
  .project-note { margin: 0; }
  .image-stage { height: min(62vh, 36rem); min-height: 22rem; }
  .thumbnail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  noscript { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* Fixed photographic viewing room. */
:root { --paper: #fff; --sidebar: 250px; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body { height: 100dvh; }
.sidebar { border: 0; padding: 40px 24px 36px 48px; }
.identity p, .nav-label, .project-link span, .sidebar-footer { display: none; }
.wordmark { line-height: .95; font-weight: 300; }
.sidebar nav { margin-top: 80px; }
.project-link { display: block; font-size: 14px; color: #161616; }
.project-link.is-active { color: #888; }
main { position: fixed; inset: 0 0 0 var(--sidebar); margin: 0; padding: clamp(48px, 7vh, 88px) clamp(48px, 5vw, 100px); min-height: 0; }
.project-intro { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.viewer { height: 100%; max-width: none; }
.image-stage { height: 100%; min-height: 0; min-width: 0; background: #fff; overflow: hidden; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
#main-image { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; }
.image-stage::after { display: none; }
.viewer-meta { position: fixed; z-index: 6; left: 48px; bottom: 72px; width: 170px; padding: 0; border: 0; flex-direction: column-reverse; align-items: flex-start; }
.counter { color: #999; font-size: 12px; }
.controls { gap: 8px; }
.controls button { font-size: 12px; text-transform: uppercase; min-width: 32px; }
.index-section { position: static; padding: 0; }
.index-heading h2 { display: none; }
#toggle-index { position: fixed; z-index: 6; left: 48px; bottom: 32px; font-size: 12px; text-transform: uppercase; }
.thumbnail-grid { position: absolute; inset: 40px; height: auto; max-height: none; margin: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 20px; visibility: hidden; background: white; transition: none; }
.thumbnail-grid.is-open { max-height: none; margin: 0; visibility: visible; }
.thumb { aspect-ratio: auto; min-height: 0; background: white; }
.thumb img { object-fit: contain; filter: none; }
body[data-project="panoramics"] .thumbnail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)) !important; }
body[data-project="panoramics"] .thumb img { width: 100%; height: auto; max-height: 100%; }
@media (max-width: 760px) {
  .menu-toggle { display: none; }
  .sidebar { width: 100%; height: 90px; inset: 0 0 auto; padding: 20px; transform: none; flex-direction: row; justify-content: space-between; }
  .wordmark { font-size: 22px; }
  .sidebar nav { margin: 0; text-align: right; display: grid; grid-template-columns: auto auto; gap: 0 16px; }
  .project-link { margin-bottom: 6px; font-size: 14px; }
  main { inset: 90px 0 90px; padding: 28px 32px; }
  .image-stage { height: 100%; min-height: 0; }
  .viewer-meta { left: 20px; bottom: 18px; width: auto; flex-direction: row-reverse; gap: 16px; align-items: center; }
  #toggle-index { left: auto; right: 20px; bottom: 24px; }
  .thumbnail-grid { inset: 10px 20px; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body[data-project="panoramics"] .thumbnail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-height: 450px) and (min-width: 761px) { .sidebar nav { margin-top: 24px; } }

.wordmark { font-family: Georgia, 'Times New Roman', serif; font-size: 25px; font-weight: 400; line-height: 1.06; letter-spacing: -.035em; }
.stage-hit--previous { cursor: url('./arrow-left.svg') 14 14, pointer; }
.stage-hit--next { cursor: url('./arrow-right.svg') 14 14, pointer; }
.stage-hit:focus-visible { outline: 1px solid #888; outline-offset: -4px; }
@media (max-width: 760px) {
  .wordmark { font-size: 24px; }
  .sidebar { height: 118px; }
  main { top: 118px; }
}

/* Refined gallery navigation and persistent photograph context. */
.sidebar { width: 230px; padding-left: 40px; padding-right: 24px; }
.sidebar nav { margin-top: 64px; }
.nav-label {
  display: block;
  margin: 0 0 8px;
  color: #8a8a8a;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav-label--section { margin-top: 20px; }
.nav-group { margin: 8px 0 12px; }
.nav-group-label {
  display: flex;
  align-items: center;
  min-height: 30px;
  margin: 0;
  color: #1a1a1a;
  font-size: 14px;
}
.nav-subitems {
  margin-left: 14px;
  padding-left: 0;
}
.nav-subitems .project-link { min-height: 28px; }
.project-link {
  min-height: 30px;
  display: flex;
  align-items: center;
  margin: 0;
  color: #1a1a1a;
  text-decoration: none;
}
.project-link.is-active {
  color: #111;
  font-weight: 600;
  text-decoration: none;
}
.project-link:hover,
.project-link:focus-visible { color: #777; }
main { left: 230px; padding-left: clamp(32px, 3vw, 60px); padding-right: clamp(32px, 4vw, 80px); }
.viewer {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}
.image-stage { height: auto; }
#main-image { object-position: center center; }
.viewer-meta {
  position: static;
  width: min(100%, var(--image-width, 100%));
  margin-inline: auto;
  min-height: 36px;
  padding: 0;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  color: #666;
}
.viewer-caption {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 13px;
}
.viewer-actions { display: flex; align-items: center; gap: 24px; }
.counter { min-width: 44px; font-size: 12px; }
.controls { gap: 18px; }
.controls button {
  min-width: 0;
  min-height: 36px;
  font-size: 12px;
  text-transform: none;
}
#toggle-index { left: 40px; }
.stage-hit { width: calc(var(--image-width, 100%) / 2); }
.stage-hit--previous { left: calc(50% - (var(--image-width, 100%) / 2)); }
.stage-hit--next { right: calc(50% - (var(--image-width, 100%) / 2)); }

@media (max-width: 760px) {
  .menu-toggle {
    display: flex;
    top: 16px;
    right: 16px;
    border-color: #d5d5d5;
    background: rgba(255, 255, 255, .96);
  }
  .sidebar {
    width: 100%;
    height: 100dvh;
    inset: 0;
    padding: 20px;
    transform: translateY(-102%);
    transition: transform 280ms ease;
    flex-direction: column;
    justify-content: flex-start;
    border-bottom: 0;
  }
  .sidebar.is-open { transform: translateY(0); }
  .sidebar nav {
    width: 100%;
    margin-top: 56px;
    display: block;
    text-align: left;
  }
  .nav-label { margin-top: 18px; }
  .nav-label:first-child { margin-top: 0; }
  .nav-group { margin: 6px 0 12px; }
  .nav-group-label { min-height: 44px; font-size: 16px; }
  .nav-subitems { margin-left: 14px; }
  .project-link { min-height: 44px; font-size: 16px; }
  main { inset: 72px 0 76px; padding: 12px 16px 0; }
  .viewer { gap: 8px; }
  .viewer-meta { min-height: 56px; gap: 12px; }
  .viewer-caption { max-width: 48%; font-size: 12px; line-height: 1.35; }
  .viewer-actions { gap: 12px; }
  .controls { gap: 10px; }
  .controls button { min-height: 44px; }
  #toggle-index { left: auto; right: 16px; bottom: 20px; min-height: 44px; }
  .thumbnail-grid { inset: 8px 16px 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-project="panoramics"] .thumbnail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* On phones, projects become a simple vertical, scrollable photo stream. */
@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body { min-height: 100dvh; }

  main {
    position: static;
    inset: auto;
    min-height: 100dvh;
    margin: 0;
    padding: 5.5rem 1rem 2rem;
  }

  .project-intro {
    position: static;
    width: auto;
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: .65rem;
    margin: 0 0 1.5rem;
    overflow: visible;
    clip-path: none;
  }

  .project-intro h1 { font-size: clamp(2.25rem, 13vw, 4rem); }
  .project-note { margin: 0; }

  .viewer,
  .index-section { display: none; }

  .mobile-gallery {
    display: grid;
    gap: 1.5rem;
  }

  .mobile-gallery figure { margin: 0; }

  .mobile-gallery img {
    width: 100%;
    height: auto;
    display: block;
  }


}
