@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-italic-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-italic-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #f4efe4;
  --paper-deep: #eae3d4;
  --ink: #201c16;
  --ink-soft: #655d50;
  --rule: #d8cfbf;
  --proof: #a83e2a;
  --proof-dark: #832f1e;
  --night: #171410;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC",
    "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, "PingFang SC",
    "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  --gutter: clamp(20px, 4vw, 72px);
  --page-max: 1560px;
  --radius: 3px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

::selection {
  background: var(--proof);
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--proof);
  outline-offset: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 140ms var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

.noscript {
  margin: 20px var(--gutter);
  color: var(--ink-soft);
  font-size: 14px;
}

.masthead-inner,
.hero-inner,
.archive-inner,
.footer-inner {
  width: min(calc(100% - (var(--gutter) * 2)), var(--page-max));
  margin-inline: auto;
}

.proof-mark {
  display: inline-block;
  width: 0.16em;
  height: 0.16em;
  margin-left: 0.2em;
  background: var(--proof);
  vertical-align: 0.08em;
}

.text-button {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--proof);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
  cursor: pointer;
  transition: color 140ms var(--ease);
}

.text-button:hover {
  color: var(--proof);
}

.text-button:disabled {
  color: var(--ink-soft);
  text-decoration-color: var(--rule);
  cursor: default;
}

/* Masthead */

.masthead-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-top: clamp(20px, 3vw, 32px);
}

.brand {
  font-family: var(--serif);
  font-size: 25px;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  text-decoration: none;
}

.nav-link {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  transition: color 140ms var(--ease);
}

.nav-link:hover {
  color: var(--proof);
  text-decoration: underline;
  text-decoration-color: var(--proof);
  text-underline-offset: 0.35em;
}

/* Hero */

.hero {
  padding-top: clamp(42px, 7vw, 86px);
  padding-bottom: clamp(46px, 6vw, 72px);
}

.hero-title {
  max-width: 1280px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(44px, 6.25vw, 90px);
  font-weight: 400;
  letter-spacing: -0.031em;
  line-height: 0.99;
  text-wrap: balance;
}

.hero-deck {
  max-width: 54ch;
  margin: clamp(18px, 2.5vw, 28px) 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}

.search-row {
  display: flex;
  align-items: baseline;
  gap: 28px;
  margin-top: clamp(36px, 5vw, 58px);
}

.search-field {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 18px;
  min-width: 0;
  border-bottom: 1px solid var(--ink);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}

.search-field:focus-within {
  border-color: var(--proof);
  box-shadow: 0 1px 0 var(--proof);
}

.search-input {
  flex: 1;
  min-width: 0;
  padding: 4px 0 12px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(22px, 2.5vw, 30px);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.2;
  appearance: none;
}

.search-input::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration {
  appearance: none;
}

.search-clear {
  flex: none;
  padding: 0 0 15px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.3em;
  cursor: pointer;
  transition: color 140ms var(--ease);
}

.search-clear:hover {
  color: var(--proof);
  text-decoration-color: var(--proof);
}

.search-count {
  flex: none;
  padding-bottom: 15px;
  color: var(--ink-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.tag-rail {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 28px;
  margin-top: 24px;
}

.tag-filter {
  display: inline-flex;
  align-items: baseline;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  transition: color 140ms var(--ease);
}

.tag-filter:hover {
  color: var(--ink);
}

.tag-filter[aria-pressed="true"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--proof);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.35em;
}

.tag-more {
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.3em;
}

.tag-more:hover {
  color: var(--ink);
  text-decoration-color: var(--proof);
}

/* Archive and wall */

.archive {
  min-height: 30vh;
}

.archive-note {
  min-height: 0;
  margin-bottom: 18px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.archive-note:empty {
  margin-bottom: 0;
}

.archive-note .text-button {
  margin-left: 8px;
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 3vw, 34px);
}

.gallery-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
}

.tile {
  display: block;
  flex: none;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.tile-media {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  background: var(--paper-deep);
  box-shadow: inset 0 0 0 1px rgb(32 28 22 / 8%);
}

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

.tile-media[data-missing="true"]::after {
  content: "Image unavailable";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
}

.tile-caption {
  display: block;
  margin-top: 9px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 140ms var(--ease);
}

.tile:hover .tile-caption,
.tile:focus-visible .tile-caption {
  color: var(--ink);
}

.tile:focus-visible {
  outline: 2px solid var(--proof);
  outline-offset: 4px;
}

/* Empty state */

.empty {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(32px, 8vw, 120px);
  padding: clamp(46px, 8vw, 96px) 0 clamp(50px, 8vw, 90px);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.empty-copy {
  max-width: 56ch;
}

.empty-title {
  max-width: 18ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.06;
  text-wrap: balance;
}

.empty-text {
  max-width: 48ch;
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}

.empty-actions {
  margin-top: 26px;
}

.empty-mark {
  display: block;
  width: clamp(120px, 18vw, 248px);
  height: clamp(120px, 18vw, 248px);
  background: color-mix(in srgb, var(--proof) 15%, var(--paper));
}

.empty.is-query {
  grid-template-columns: minmax(0, 1fr);
  padding-block: clamp(42px, 6vw, 70px);
}

.empty.is-query .empty-mark {
  display: none;
}

.empty.is-query .empty-title {
  max-width: 28ch;
}

/* Load more */

.load-wrap {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-top: clamp(28px, 4vw, 42px);
}

.load-count {
  color: var(--ink-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Footer */

.footer {
  margin-top: clamp(76px, 12vw, 150px);
  border-top: 1px solid var(--rule);
}

.footer-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding-block: 28px 38px;
}

.footer-wordmark {
  display: inline-block;
  font-family: var(--serif);
  font-size: 21px;
  font-style: italic;
  font-weight: 500;
  line-height: 1;
}

.footer-brand p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.footer-links {
  display: flex;
  gap: 22px;
  color: var(--ink-soft);
  font-size: 12px;
}

.footer-links a {
  text-decoration-color: var(--rule);
}

.footer-links a:hover {
  color: var(--ink);
  text-decoration-color: var(--proof);
}

/* Reading room */

.viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.viewer::backdrop {
  background: rgb(23 20 16 / 96%);
}

.viewer[open] {
  animation: viewer-in 180ms var(--ease) both;
}

@keyframes viewer-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.viewer-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  width: 100%;
  height: 100dvh;
}

.viewer-stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  padding: clamp(20px, 4vw, 58px);
  background: var(--night);
  overflow: hidden;
}

.viewer-image {
  max-width: 100%;
  max-height: calc(100dvh - clamp(40px, 8vw, 116px));
  object-fit: contain;
}

.viewer-position {
  position: absolute;
  z-index: 2;
  right: clamp(20px, 3vw, 34px);
  bottom: clamp(16px, 2.5vw, 26px);
  color: rgb(244 239 228 / 62%);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.viewer-stage-note {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--paper);
  font-size: 13px;
  text-align: center;
}

.viewer-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  background: var(--paper);
}

.viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px clamp(22px, 3vw, 34px) 0;
}

.viewer-seq {
  color: var(--ink-soft);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.viewer-close {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  place-items: center;
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: border-color 140ms var(--ease), color 140ms var(--ease);
}

.viewer-close:hover {
  border-color: var(--proof);
  color: var(--proof);
}

.viewer-body {
  flex: 1;
  padding: clamp(30px, 4vw, 46px) clamp(22px, 3vw, 34px) 34px;
}

.viewer-title {
  max-width: 24ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(27px, 2.6vw, 36px);
  font-weight: 400;
  letter-spacing: -0.024em;
  line-height: 1.08;
  text-wrap: balance;
}

.viewer-description {
  max-width: 56ch;
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
}

.viewer-description:empty {
  display: none;
}

.viewer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  margin-top: 20px;
}

.viewer-tag {
  min-height: 32px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.3em;
  cursor: pointer;
}

.viewer-tag:hover {
  color: var(--proof);
  text-decoration-color: var(--proof);
}

.viewer-meta {
  display: grid;
  gap: 10px;
  margin: 34px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
}

.viewer-meta > div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
}

.viewer-meta dt {
  color: var(--ink-soft);
}

.viewer-meta dd {
  margin: 0;
}

.viewer-meta a {
  text-decoration-color: var(--proof);
}

.viewer-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(22px, 3vw, 34px) 20px;
  border-top: 1px solid var(--rule);
}

.viewer-nav .text-button {
  padding: 8px 0;
}

.viewer-hint {
  flex: 1;
  color: var(--ink-soft);
  font-size: 11px;
  text-align: center;
}

body.viewer-open {
  overflow: hidden;
}

/* 404 */

.not-found {
  display: grid;
  min-height: 70vh;
  align-content: center;
  width: min(calc(100% - (var(--gutter) * 2)), var(--page-max));
  margin-inline: auto;
  padding-block: 72px;
}

.not-found h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1;
}

.not-found p {
  max-width: 48ch;
  margin: 20px 0 30px;
  color: var(--ink-soft);
}

/* Responsive */

@media (max-width: 1000px) {
  .viewer-shell {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
}

@media (max-width: 720px) {
  .masthead-inner {
    padding-top: 20px;
  }

  .brand {
    font-size: 22px;
  }

  .hero {
    padding-top: 40px;
    padding-bottom: 38px;
  }

  .hero-title {
    font-size: clamp(39px, 10.6vw, 56px);
    letter-spacing: -0.028em;
  }

  .hero-deck {
    font-size: 14px;
  }

  .search-row {
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 32px;
  }

  .search-field {
    flex-basis: 100%;
  }

  .search-input {
    padding-bottom: 9px;
    font-size: 21px;
  }

  .search-clear {
    padding-bottom: 11px;
  }

  .search-count {
    padding: 0;
  }

  .tag-rail {
    gap: 8px 18px;
    margin-top: 20px;
  }

  .tag-filter {
    font-size: 12px;
  }

  .tag-rail {
    gap: 4px 18px;
  }

  .empty {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding-block: 42px;
  }

  .empty-mark {
    display: none;
  }

  .viewer {
    overflow-y: auto;
    background: var(--paper);
  }

  .viewer-shell {
    display: block;
    height: auto;
    min-height: 100dvh;
  }

  .viewer-stage {
    height: 54dvh;
    min-height: 280px;
    padding: 18px;
  }

  .viewer-image {
    max-height: calc(54dvh - 36px);
  }

  .viewer-position {
    padding: 4px 7px;
    background: rgb(23 20 16 / 62%);
    color: rgb(244 239 228 / 78%);
    border-radius: 2px;
  }

  .viewer-panel {
    overflow: visible;
  }

  .viewer-top {
    padding-top: 24px;
  }

  .viewer-close {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 5;
    border-color: rgb(244 239 228 / 30%);
    background: rgb(23 20 16 / 24%);
    color: var(--paper);
  }

  .viewer-close:hover {
    border-color: var(--paper);
    color: var(--paper);
  }

  .viewer-body {
    padding-top: 12px;
  }

  .viewer-title {
    max-width: none;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .viewer[open] {
    animation: none;
  }

  .skip-link {
    transition: none;
  }
}
