:root {
  /* Reserve the vertical scrollbar on both short photo and long archive views. */
  overflow-y: scroll;
  color-scheme: light;
  font-family: Verdana, Arial, "Microsoft YaHei", sans-serif;
  color: #828282;
  background: #ccc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

a:hover,
button:hover {
  color: #222;
}

a:focus-visible,
button:focus-visible {
  outline: 1px solid #888;
  outline-offset: 5px;
}

[hidden] {
  display: none !important;
}

.page {
  width: min(1050px, 100%);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  background: #fff;
  padding: 38px 0 70px;
}

.header {
  padding: 0 28px;
}

.home {
  display: inline-flex;
  align-items: center;
  gap: 24px;
}

.header-image {
  display: block;
  object-fit: cover;
}

.site-name {
  color: #525252;
  font-size: 23px;
  font-weight: 400;
  letter-spacing: .32em;
}

.layout {
  display: grid;
  grid-template-columns: 181px minmax(0, 1fr);
  column-gap: 50px;
  margin-top: 46px;
  padding-right: 55px;
  align-items: start;
}

.navigation {
  display: flex;
  flex-direction: column;
  align-items: start;
  padding: 21px 25px 23px;
  gap: 10px;
  background: #f0f0f0;
  border-radius: 0 22px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.navigation [aria-current="page"] {
  color: #252525;
}

.navigation a { overflow-wrap: anywhere; }
.gallery-message { margin: 0; font-size: 12px; line-height: 1.8; }

.navigation .external-link {
  margin-top: 30px;
}

.content {
  min-width: 0;
  padding-top: 15px;
}

.archive-back {
  position: sticky;
  top: 12px;
  z-index: 1;
  display: table;
  margin: 0 0 18px;
  padding: 2px 0;
  background: #fff;
  color: #828282;
  font-size: 14px;
  line-height: 1.4;
}

.photo-view {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

figure {
  margin: 0;
}

.photo-link {
  display: block;
  /* Keep the caption and paging on one baseline for every image orientation. */
  height: clamp(220px, calc(100vh - 250px), 700px);
  height: clamp(220px, calc(100svh - 250px), 700px);
  touch-action: pan-y pinch-zoom;
}

#photograph {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

figcaption {
  min-height: 37px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  padding-top: 12px;
  font-size: 10px;
  line-height: 1.6;
}

.paging {
  display: flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
  margin-left: auto;
}

#photo-title { min-width: 0; overflow-wrap: anywhere; }

.paging button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: none;
  color: #777;
  font: 20px/1 Georgia, serif;
  cursor: pointer;
}

.source {
  display: inline-block;
  margin-top: 17px;
  font-size: 9px;
  color: #aaa;
}

.thumbnails {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px 26px;
}

.thumbnail {
  min-width: 0;
  text-align: center;
}

.thumbnail img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

.thumbnail span {
  display: block;
  margin-top: 10px;
  font-size: 9px;
  line-height: 1.6;
}

.thumbnail:hover img {
  opacity: .85;
}

.archive-more {
  margin-top: 28px;
  text-align: right;
  font-size: 12px;
  line-height: 1.5;
}

.see-more span { margin-left: 6px; }

@media (max-width: 700px) {
  :root {
    background: #fff;
  }

  .page {
    padding: 25px 0 40px;
  }

  .header {
    padding: 0 24px;
  }

  .home {
    gap: 17px;
  }

  .header-image {
    width: 40px;
    height: 40px;
  }

  .site-name {
    font-size: 18px;
    letter-spacing: .22em;
  }

  .layout {
    display: block;
    margin-top: 27px;
    padding: 0;
  }

  .navigation {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: start;
    gap: 26px;
    padding: 15px 24px;
    border-radius: 0;
    font-size: 11px;
  }

  .navigation .external-link {
    margin: 0 0 0 auto;
  }

  .content {
    padding: 30px 24px 0;
  }

  .photo-link {
    height: clamp(180px, calc(100vh - 330px), 600px);
    height: clamp(180px, calc(100svh - 330px), 600px);
  }

  .thumbnails {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 20px;
  }
}
