:root {
  --nav-offset: 72px;
  --page-padding: 20px;
  --control-offset: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Helvetica, sans-serif;
  background: white;
  color: black;
  overflow-x: hidden;
}


.nav-bar {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  grid-template-columns: minmax(180px, auto) 1fr;
  align-items: center;
  padding: 16px 24px;
  gap: 16px 24px;
  z-index: 20;
  letter-spacing: -0.06em;
}

.nav-bar a {
  color: black;
  text-decoration: none;
}

.nav-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.12;
  z-index: -1;
}

.nav-bar a:visited,
.nav-bar a:hover {
  color: black;
  text-decoration: none;
}

.site-title {
  font-size: 18px;
  color: black;
  letter-spacing: -0.06em;
  text-align: left;
  white-space: nowrap;
}

.site-description {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: -0.06em;
  color: black;
  text-decoration: italic;
  margin-left: 10px;
  margin-bottom: -5px;
}

.nav-links {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

.nav-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.page-shell {
  min-height: calc(100vh - var(--nav-offset));
  padding: 12px var(--page-padding) calc(88px + env(safe-area-inset-bottom));
}

.container {
  position: relative;
  width: min(100%, 1400px);
  height: calc(100vh - var(--nav-offset) - 32px);
  min-height: 420px;
  margin: 0 auto;
}

#image-wrapper {
  width: 100%;
  height: 100%;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.grid {
  --grid-cols: 40;
  --grid-rows: 30;
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--grid-rows), minmax(0, 1fr));
  z-index: 5;
  width: 100%;
  height: 100%;
}

.grid.is-hidden {
  display: none;
}

.cell {
  background: white;
  box-shadow: inset 0 0 0 0.25px #ccc;
  will-change: opacity;
}

.controls {
  position: fixed;
  right: var(--control-offset);
  bottom: calc(var(--control-offset) + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  z-index: 12;
}

button {
  appearance: none;
  -webkit-appearance: none;
  background-color: white;
  border: 1px solid black;
  padding: 10px 18px;
  min-height: 44px;
  font-size: 13px;
  font-family: Helvetica, sans-serif;
  cursor: pointer;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  color: black;
  touch-action: manipulation;
}

button:hover,
button:focus-visible {
  background-color: black;
  color: white;
}

.image-credit {
  font-size: 12px;
  color: black;
  text-align: left;
  margin-top: 0;
  margin-left: 30px;
  padding-bottom: 10px;
  font-family: Helvetica, sans-serif;
  letter-spacing: -0.06em;
}


@media (max-width: 900px) {
  :root {
    --nav-offset: 132px;
  }

  .nav-bar {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 14px 16px;
    gap: 12px;
  }

  .site-title {
    width: 100%;
    text-align: center;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
  }

  .nav-left,
  .nav-right {
    justify-content: center;
  }

  .container {
    height: calc(100svh - var(--nav-offset) - 24px);
  }
}

@media (max-width: 768px) {
  :root {
    --nav-offset: 168px;
    --page-padding: 12px;
    --control-offset: 12px;
  }

  body {
    overflow-y: auto;
  }

  .nav-bar {
    gap: 10px;
  }

  .nav-links {
    flex-direction: column;
    gap: 10px;
  }

  .nav-group {
    width: 100%;
    justify-content: center;
    gap: 18px;
  }

  .site-title {
    font-size: 16px;
    text-align: center;
    display: block;
  }

  .site-description {
    text-align: center;
    margin-bottom: 10px;
  }

  .title-block {
    width: 100%;
    text-align: center;
  }



  .container {
    min-height: 360px;
    height: calc(100svh - var(--nav-offset) - 20px);
    max-height: 72svh;
  }

  .controls {
    left: 12px;
    right: 12px;
    justify-content: center;
  }

  button {
    flex: 1 1 140px;
    max-width: 220px;
  }
}

@media (max-width: 480px) {
  :root {
    --nav-offset: 176px;
  }

  .nav-bar {
    padding: 12px;
  }

  .nav-links {
    gap: 8px;
  }

  .nav-group {
    gap: 14px 18px;
  }

  .container {
    min-height: 300px;
    max-height: 64svh;
  }
}

[hidden] { display: none !important; }
:root { --nav-offset: 58px; }
html { scroll-padding-top: 94px; }
.nav-links { gap: 12px; letter-spacing: -0.04em; font-size: 16px; }
.nav-links [aria-current] { text-decoration: underline; text-underline-offset: 5px; }
.site-title { text-transform: none; }
a:focus-visible { outline: 2px solid black; outline-offset: 5px; }
h1:focus, h2:focus { outline: none; }
.container { height: auto; min-height: calc(100vh - var(--nav-offset) - 32px); }
.surface-active .container { height: calc(100vh - var(--nav-offset) - 32px); min-height: 420px; overflow: hidden; }
#surface { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
#image-wrapper { background: transparent; }
.image { opacity: 1; }
#portfolio { position: relative; color: black; padding: 24px 32px 60px; }
.surface-active #portfolio { visibility: hidden; user-select: none; }
h1, h2 { margin: 0; font-weight: 400; letter-spacing: -0.04em; }
#work-title { font-size: 14px; margin-bottom: 26px; }
.project-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) minmax(150px, 230px);
  gap: 20px;
  align-items: baseline;
  padding: 24px 0;
  border-top: 1px solid #ddd;
  color: black;
  text-decoration: none;
}
.project-row:last-child { border-bottom: 1px solid #ddd; }
.project-row:hover .project-name { text-decoration: underline; text-underline-offset: 6px; }
.project-number { font-size: 14px; }
.project-name { font-size: clamp(22px, 2.8vw, 38px); letter-spacing: -0.055em; line-height: 1.15; }
.project-meta { font-size: 14px; color: #666; letter-spacing: -0.02em; line-height: 1.5; }
.text-section { margin-top: 100px; padding-top: 24px; border-top: 1px solid #ddd; }
.text-section h2 { font-size: 28px; margin-bottom: 26px; }
.text-section p, .project-description p { max-width: 640px; font-size: 18px; line-height: 1.55; letter-spacing: -0.025em; }
.placeholder-copy { color: black; }
.back-link, .project-external { color: black; font-size: 16px; text-underline-offset: 4px; }
.back-link { display: inline-block; margin-bottom: 64px; }
#project-title { font-size: clamp(32px, 5vw, 64px); line-height: 1.08; max-width: 850px; }
.project-description { margin-top: 32px; }
.project-external { display: inline-block; margin-top: 24px; }
.project-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.project-images:not(:empty) { margin-top: 48px; }
.project-images img { display: block; width: 100%; height: auto; }
.see-work {
  display: inline-flex; align-items: center; justify-content: center;
  background: white; color: black; border: 1px solid black;
  padding: 10px 18px; min-height: 44px; border-radius: 999px;
  text-decoration: none; font-size: 13px; letter-spacing: 1px;
  transition: background-color .2s, color .2s;
}
.see-work:hover { background: black; color: white; }
.image-credit { position: fixed; bottom: 28px; left: 24px; margin: 0; padding: 0; z-index: 10; }
@media (max-width: 900px) {
  :root { --nav-offset: 96px; }
  .nav-bar { grid-template-columns: 1fr; }
  .nav-links { flex-direction: row; flex-wrap: nowrap; gap: 10px; }
  .surface-active .nav-bar { min-height: 58px; }
  .surface-active { --nav-offset: 58px; }
  #portfolio { padding: 24px 16px 48px; }
  .project-row { grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 20px 0; }
  .project-row .project-meta { grid-column: 2; }
}
@media (max-width: 768px) {
  :root { --nav-offset: 100px; }
  .surface-active .container { height: calc(100svh - var(--nav-offset) - 90px); min-height: 300px; max-height: none; }
  .container { max-height: none; }
  .controls { left: 12px; right: 12px; justify-content: center; flex-wrap: nowrap; }
  .controls > * { flex: 0 1 auto; }
  .image-credit { left: 12px; right: 12px; bottom: 72px; font-size: 12px; line-height: 1.3; }
  #portfolio { padding: 20px 8px 40px; }
  .text-section { margin-top: 64px; }
  .project-images { grid-template-columns: 1fr; }
  .back-link { margin-bottom: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

.image-credit {
  position: static;
  width: min(100%, 1400px);
  margin: 8px auto 0;
  padding: 0;
  text-align: left;
}

.page-shell {
  position: relative;
}

.controls {
  position: absolute;
  top: calc(12px + 100vh - var(--nav-offset) - 32px - 60px);
  bottom: auto;
  right: max(
    var(--page-padding),
    calc((100% - 1400px) / 2)
  );
  left: auto;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .controls {
    position: static;
    margin: 16px auto 0;
    justify-content: center;
  }
}
