:root {
  --page: #f8f7f2;
  --ink: #111;
  --muted: #777;
  --rule: 1px solid var(--ink);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 12pt;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  line-height: 1.15;
}

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

a:hover,
.image-back:hover {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.menu {
  position: fixed;
  top: 18px;
  left: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  z-index: 10;
}

.name {
  position: relative;
  display: inline-grid;
  font-weight: 700;
  font-style: normal;
  font-family: Helvetica, Arial, sans-serif;
}

.name .latin,
.name .han {
  grid-area: 1 / 1;
}

.name:hover {
  font-style: normal;
  font-family: Helvetica, Arial, sans-serif;
}

.name .han {
  opacity: 0;
}

.name:hover .latin {
  opacity: 0;
}

.name:hover .han {
  opacity: 1;
}

.command {
  display: inline-flex;
  align-items: center;
  margin-top: 0;
  max-width: calc(100vw - 36px);
}

.command-entry {
  display: inline-flex;
  align-items: center;
  min-width: 1ch;
  max-width: calc(100vw - 48px);
}

.command input {
  width: calc((var(--chars, 0) * 1ch) + 1px);
  min-width: 1px;
  max-width: calc(100vw - 72px);
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  height: 1em;
  caret-color: var(--ink);
  outline: none;
}

.command input:focus {
  outline: none;
}

.enter {
  margin-left: 4px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 120ms ease;
}

.command.has-text .enter {
  opacity: 1;
}

.contact {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: max-content;
  min-height: 0;
  padding: 0;
  font-style: normal;
  text-align: right;
  z-index: 4;
}

.page-contact {
  z-index: 4;
}

.page {
  padding: 18px;
}

.page-header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 0 14px;
  background: var(--page);
  z-index: 5;
}

.page-title {
  margin: 0;
  font: inherit;
  font-weight: 700;
}

.about-layout {
  max-width: 420px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
}

.about-image {
  width: min(260px, 100%);
}

.about-image img {
  display: block;
  width: 100%;
  height: auto;
}

.about-text p {
  margin: 0 0 1em;
}

.about-cv-link {
  text-decoration: underline;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 42px 30px;
  align-items: start;
  padding-top: 12px;
}

.pdf-card {
  display: block;
  max-width: 260px;
  aspect-ratio: 1 / 1.414;
  border: var(--rule);
  padding: clamp(10px, 1.2vw, 16px);
  overflow: hidden;
  background: #fbfaf6;
}

.pdf-title {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 3.4vw, 58px);
  font-weight: 700;
  line-height: .78;
  letter-spacing: -.08em;
  transform: scaleX(.82);
  transform-origin: left top;
  word-break: break-word;
}

.image-grid {
  --image-gap: 24px;
  position: relative;
  gap: var(--image-gap);
  padding: 0;
  margin-top: 12px;
}

.image-card {
  position: absolute;
  display: block;
  margin: 0;
  min-width: 0;
  width: var(--packed-width, 100%);
  height: var(--packed-height, auto);
  left: var(--packed-x, 0);
  top: var(--packed-y, 0);
  transition: transform 420ms ease, opacity 260ms ease;
  transform-origin: left top;
}

.image-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  background: #eeede8;
}

.image-placeholder {
  aspect-ratio: var(--ratio, 4 / 3);
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #eeede8;
}

.image-back {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.image-detail-text {
  position: fixed;
  left: auto;
  bottom: auto;
  right: auto;
  z-index: 9;
  width: min(300px, 32vw);
  max-width: 300px;
  color: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease 220ms;
}

.image-detail-title,
.image-detail-body {
  display: block;
}

.image-detail-title {
  font-weight: 700;
}

.image-detail-media {
  position: fixed;
  left: 18px;
  top: 72px;
  z-index: 8;
  width: calc(100vw - 336px);
  height: calc(100vh - 174px);
  object-fit: contain;
  background: #eeede8;
  opacity: 0;
  pointer-events: none;
  transition: none;
}

body.image-open {
  overflow: hidden;
}

.image-open .page-contact {
  display: none;
}

.image-open .site-back {
  display: none;
}

.image-open .image-back {
  display: inline;
}

.image-open .image-grid {
  position: fixed;
  inset: 18px;
  z-index: 6;
  display: block;
  margin: 0;
  pointer-events: none;
}

.image-open .image-card {
  position: fixed;
  pointer-events: none;
  margin: 0;
}

.image-open .image-card:not(.is-selected) {
  opacity: 0;
  transform: translateX(var(--exit-x, -120vw)) scale(.8);
}

.image-open .image-card.is-selected {
  z-index: 8;
  opacity: 1;
  transform: translate(var(--detail-x), var(--detail-y)) scale(var(--detail-scale));
}

.image-detail-ready .image-card.is-selected {
  opacity: 0;
}

.image-detail-ready .image-detail-media {
  opacity: 1;
}

.image-open .image-detail-text {
  opacity: 1;
}

.links-list {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.project-index {
  margin-top: 12px;
  overflow-x: auto;
}

.project-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.project-table th,
.project-table td {
  padding: 7px 12px 7px 0;
  border-bottom: 1px solid rgb(17 17 17 / 22%);
  text-align: left;
  vertical-align: top;
  font: inherit;
}

.project-table thead th {
  border-bottom-color: var(--ink);
  font-weight: 700;
}

.project-table button,
.project-tag {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.project-table a,
.project-table button {
  display: inline-block;
  max-width: 100%;
  padding-right: .35em;
}

.project-table thead button {
  position: relative;
  font-weight: 700;
  padding-right: .7em;
}

.project-table thead button.is-active::after {
  content: "";
  position: absolute;
  right: 0;
  top: .05em;
  font-size: .58em;
  line-height: 1;
}

.project-table thead button.is-active[data-direction="asc"]::after {
  content: "▴";
}

.project-table thead button.is-active[data-direction="desc"]::after {
  content: "▾";
}

.project-table button:hover,
.project-tag:hover {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.project-tag.is-muted {
  color: var(--muted);
}

.project-tag.is-active {
  font-weight: 700;
}

.project-tag {
  margin-right: .12em;
}

.project-table th:first-child,
.project-table td:first-child {
  width: 18%;
}

.project-table th:nth-child(2),
.project-table td:nth-child(2) {
  width: 34%;
}

.project-table th:nth-child(3),
.project-table td:nth-child(3) {
  width: 20%;
}

.project-table th:nth-child(4),
.project-table td:nth-child(4) {
  width: 9%;
}

.project-table tbody tr {
  cursor: pointer;
}

.project-table tbody tr:hover th,
.project-table tbody tr:hover td {
  border-bottom-color: var(--ink);
}

.project-detail {
  max-width: 760px;
  margin-top: 12px;
}

.project-meta dl {
  margin: 0 0 28px;
}

.project-meta div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  border-bottom: 1px solid rgb(17 17 17 / 22%);
  padding: 4px 0;
}

.project-meta dt {
  font-weight: 700;
}

.project-meta dd {
  margin: 0;
}

.project-section {
  margin: 0 0 28px;
}

.project-section h2 {
  margin: 0 0 7px;
  font: inherit;
  font-weight: 700;
}

.project-section p {
  margin: 0 0 1em;
}

.project-formula {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.project-formula span {
  font-family: Helvetica, Arial, sans-serif;
  font-style: normal;
}

.project-video {
  margin: 0 0 18px;
}

.project-video figcaption,
.project-media figcaption {
  margin-bottom: 4px;
  color: var(--muted);
}

.project-video-frame {
  position: relative;
  width: min(640px, 100%);
  aspect-ratio: 16 / 9;
  background: #eeede8;
}

.project-video-frame iframe,
.project-video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.project-media figure {
  margin: 0;
}

.project-media {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 24px;
  align-items: flex-start;
}

.project-media h2 {
  flex: 0 0 100%;
}

.project-media figure {
  flex: 1 1 260px;
  max-width: 360px;
}

.project-media img {
  display: block;
  width: 100%;
  height: auto;
  background: #eeede8;
}

.project-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 80px;
}

@media (max-width: 720px) {
  .menu {
    position: static;
  }

  .home {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
  }

  .contact {
    right: 18px;
    bottom: 18px;
    margin-top: 0;
  }

  .page {
    padding: 18px;
  }

  .about-layout {
    margin-top: 12px;
  }

  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 34px 18px;
  }

  .image-grid {
    --image-gap: 20px;
  }

  .project-table {
    min-width: 760px;
  }

  .project-detail {
    max-width: none;
  }

  .project-meta div {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .pdf-card {
    max-width: none;
  }

  .image-detail-text {
    width: calc(100vw - 36px);
    max-width: calc(100vw - 36px);
  }

  .image-detail-media {
    left: 18px;
    top: 72px;
    width: calc(100vw - 36px);
  }

  .image-open .image-detail-text {
    transform: translateY(0);
  }
}
