:root {
  --bg: #f7f5ef;
  --ink: #111;
  --soft: #6f6a60;
  --rule: rgba(17, 17, 17, 0.13);
  --paper: #fffdf8;
  --image-ratio: 4 / 5;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Courier New", "PingFang SC", "Microsoft YaHei", monospace;
  margin: 0;
}

img {
  display: block;
  -webkit-touch-callout: none;
  pointer-events: none;
  user-select: none;
  width: 100%;
}

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

.sidebar {
  border-right: 1px solid var(--rule);
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  left: 0;
  padding: 24px 20px;
  position: fixed;
  top: 0;
  width: 300px;
  z-index: 10;
}

.name,
.info-link,
.category-label,
.sections a,
.meta,
.collection-header p,
.collection-header span,
.viewer p,
.viewer-close {
  font-size: 12px;
  line-height: 1.45;
}

.name {
  font-family: "Courier New", "PingFang SC", "Microsoft YaHei", monospace;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  margin-bottom: 34px;
}

.info-link {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font-size: 9px;
  line-height: 1;
  margin-bottom: 36px;
  padding: 0;
  text-align: left;
  width: max-content;
}

.category-label {
  color: #8e8a83;
  font-size: 9px;
  line-height: 1;
  margin: 0 0 22px;
  text-transform: uppercase;
}

.sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sections a {
  align-items: flex-start;
  color: var(--soft);
  display: grid;
  gap: 9px;
  grid-template-columns: 8px 1fr;
}

.sections a::before {
  background: rgba(17, 17, 17, 0.08);
  border-radius: 999px;
  content: "";
  height: 8px;
  margin-top: 7px;
  width: 8px;
}

.sections a:hover {
  color: var(--ink);
}

.sections a.is-active::before {
  background: #d20f0f;
}

.sections span {
  display: none;
}

.sections strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0;
  line-height: 1.1;
  writing-mode: horizontal-tb;
}

.meta {
  color: var(--soft);
  font-size: 10px;
  margin: auto 0 0;
}

.page {
  margin-left: 300px;
}

.collection-header p,
.collection-header span {
  color: inherit;
  margin: 0;
  text-transform: uppercase;
}

.collection {
  border-top: 1px solid var(--rule);
  padding: 30px 30px 96px;
}

.collection[hidden] {
  display: none;
}

.collection-header {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  padding: 0 0 28px;
}

.collection-header p,
.collection-header span {
  color: var(--soft);
}

.info-panel {
  background: var(--bg);
  border-left: 1px solid var(--rule);
  bottom: 0;
  left: 300px;
  opacity: 0;
  padding: 118px 8vw;
  pointer-events: none;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(100%);
  transition: opacity 260ms ease, transform 360ms ease;
  z-index: 24;
}

.info-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.info-content {
  color: var(--ink);
  font-family: "Courier New", "PingFang SC", "Microsoft YaHei", monospace;
  font-size: 12px;
  line-height: 1.45;
  max-width: 720px;
}

.info-content p {
  margin: 0 0 8px;
}

.info-content a {
  text-decoration: none;
}

.photo-stream {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.photo-card {
  appearance: none;
  aspect-ratio: var(--image-ratio);
  background: #e8e2d8;
  border: 0;
  cursor: pointer;
  display: grid;
  margin: 0;
  padding: 0;
  position: relative;
  place-items: center;
  text-align: left;
  width: 100%;
}

.photo-card img {
  height: 100%;
  object-fit: contain;
  transition: filter 220ms ease, transform 280ms ease;
  width: 100%;
}

.photo-card:hover img,
.photo-card:focus-visible img {
  filter: contrast(1.05) saturate(0.88);
}

.photo-card.is-fill img {
  object-fit: cover;
}

@media (max-width: 980px) and (min-width: 561px) {
  .photo-stream {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.viewer {
  align-items: center;
  background: rgba(9, 9, 9, 0.94);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  inset: 0;
  opacity: 0;
  padding: 44px 54px 24px;
  pointer-events: none;
  position: fixed;
  z-index: 30;
}

.viewer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.viewer img {
  justify-self: center;
  max-height: calc(100vh - 188px);
  max-width: 80vw;
  object-fit: contain;
  transition: opacity 180ms ease, transform 220ms ease;
  width: auto;
}

.viewer img.is-changing {
  opacity: 0;
  transform: translateX(var(--viewer-shift, 0));
}

.viewer p,
.viewer-close,
.viewer-nav {
  color: var(--paper);
  font-family: "Courier New", "PingFang SC", "Microsoft YaHei", monospace;
  text-transform: uppercase;
}

.viewer p {
  font-size: 12px;
  margin: 12px 0 14px;
  text-align: center;
}

.viewer-close,
.viewer-nav {
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  padding: 12px;
  position: fixed;
}

.viewer-close {
  right: 24px;
  top: 20px;
}

.viewer-nav {
  top: 50%;
  transform: translateY(-50%);
}

.viewer-prev {
  left: 22px;
}

.viewer-next {
  right: 22px;
}

.viewer-thumbs {
  display: flex;
  gap: 10px;
  justify-self: center;
  max-width: min(760px, 86vw);
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-color: rgba(255, 255, 255, 0.34) transparent;
}

.viewer-thumb {
  appearance: none;
  background: rgba(255, 253, 248, 0.08);
  border: 1px solid transparent;
  cursor: pointer;
  flex: 0 0 auto;
  height: 56px;
  opacity: 0.48;
  padding: 0;
  transition: border-color 160ms ease, opacity 160ms ease;
  width: 42px;
}

.viewer-thumb.is-active {
  border-color: var(--paper);
  opacity: 1;
}

.viewer-thumb img {
  height: 100%;
  max-height: none;
  max-width: none;
  object-fit: contain;
  width: 100%;
}

@media (max-width: 560px) {
  .sidebar {
    background: rgba(247, 245, 239, 0.88);
    border-bottom: 1px solid var(--rule);
    border-right: 0;
    bottom: auto;
    align-items: center;
    flex-direction: row;
    gap: 16px;
    left: 0;
    padding: 15px 18px;
    right: 0;
    width: auto;
    backdrop-filter: blur(18px);
  }

  .meta {
    display: none;
  }

  .info-link,
  .category-label {
    display: none;
  }

  .page {
    margin-left: 0;
  }

  .info-panel {
    left: 0;
    padding: 104px 24px;
  }

  .collection-header {
    grid-template-columns: 1fr;
  }

  .name {
    flex: 0 0 auto;
    margin: 0;
  }

  .name,
  .info-link,
  .category-label,
  .sections a,
  .collection-header p,
  .collection-header span {
    font-size: 11px;
  }

  .sections {
    flex-direction: row;
    flex: 1 1 auto;
    gap: 14px;
    justify-content: flex-end;
    min-width: 0;
  }

  .sections a {
    display: flex;
    gap: 7px;
    min-width: 0;
  }

  .sections a::before {
    margin-top: 1px;
  }

  .sections strong {
    font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }

  .collection {
    padding: 24px 10px 64px;
  }

  .photo-stream {
    gap: 10px;
    grid-template-columns: 1fr;
  }

  .viewer {
    padding: 54px 14px 18px;
  }

  .viewer img {
    max-height: calc(100vh - 178px);
    max-width: 94vw;
  }

  .viewer-nav {
    bottom: 80px;
    top: auto;
    transform: none;
  }
}
