@font-face {
  font-family: "Ultra";
  src: url("fonts/ultra.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "League Gothic";
  src: url("fonts/league-gothic.woff2") format("woff2");
  font-stretch: 75% 100%;
  font-display: swap;
}

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

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

:root {
  color-scheme: dark;
  --night: #0b0a0c;
  --stage: #17151a;
  --line: #322e36;
  --cream: #f6efe0;
  --muted: #b9b0a2;
  --red: #e0312b;
  --blue: #2447c8;
  --sawdust: #efbd5e;
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --poster: "Ultra", Rockwell, Georgia, serif;
  --display: "League Gothic", "Arial Narrow", sans-serif;
  --text: "Newsreader", Georgia, serif;
}

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

html {
  background: var(--night);
  color: var(--cream);
  font-family: var(--text);
  font-size: 118.75%;
  line-height: 1.5;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
}

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

a {
  color: var(--sawdust);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--cream);
}

:focus-visible {
  outline: 2px solid var(--sawdust);
  outline-offset: 3px;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.015em;
  line-height: 1.05;
  text-transform: uppercase;
}

/* The scalloped edge of the tent, in the stripes of the circus tent. */
.valance {
  position: relative;
  z-index: 3;
  height: 30px;
  background: repeating-linear-gradient(
    90deg,
    var(--red) 0 44px,
    var(--cream) 44px 88px,
    var(--blue) 88px 132px,
    var(--cream) 132px 176px
  );
  filter: drop-shadow(0 3px 5px rgb(0 0 0 / 55%));
  -webkit-mask:
    linear-gradient(#000 0 8px) top / 100% 8px no-repeat,
    radial-gradient(circle at 22px 8px, #000 21.5px, transparent 22px)
      0 0 / 44px 30px repeat-x;
  mask:
    linear-gradient(#000 0 8px) top / 100% 8px no-repeat,
    radial-gradient(circle at 22px 8px, #000 21.5px, transparent 22px)
      0 0 / 44px 30px repeat-x;
}

/* The header. */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  padding: 0.75rem var(--gutter);
}

.wordmark {
  color: var(--cream);
  font-family: var(--poster);
  font-size: 1.25rem;
  line-height: 1.2;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: 1.5rem;
}

.site-header nav a {
  color: var(--cream);
  font-family: var(--display);
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.site-header nav a:hover {
  color: var(--sawdust);
}

.home .site-header {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 0;
  left: 0;
  padding-top: 1.5rem;
}

.home .site-header nav a {
  color: var(--night);
}

.home .site-header nav a:hover {
  color: var(--red);
}

.home .wordmark {
  visibility: hidden;
}

/* The start page. */
/* The hero is a poster. Its background continues the white studio backdrop of
   the photograph, which is moved to the right to leave room for the title. */
.hero {
  --paper: linear-gradient(
    #f4f4f4, #f6f6f6 50%, #ededed 75%, #dcdadb 87.5%, #c4c3c1
  );
  position: relative;
  display: flex;
  align-items: center;
  min-height: min(92vh, 62rem);
  margin-top: -30px;
  overflow: hidden;
  background: var(--paper);
  color: var(--night);
}

.hero img {
  position: absolute;
  top: 0;
  right: 0;
  width: auto;
  max-width: none;
  height: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%);
  mask-image: linear-gradient(90deg, transparent, #000 20%);
  transform: translateX(16%);
}

.hero-text {
  position: relative;
  z-index: 1;
  max-width: 47vw;
  padding: 5rem var(--gutter) 2rem;
}

.hero h1 {
  margin: 0;
  font-family: var(--poster);
  font-size: clamp(2.6rem, 7vw, 8.75rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
  text-shadow: 0.045em 0.045em 0 var(--red);
  text-transform: none;
}

.kicker {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero .kicker {
  display: inline-block;
  margin-bottom: 0.6rem;
  padding: 0.1rem 0.6rem 0;
  background: var(--night);
  color: var(--sawdust);
  font-size: clamp(1.2rem, 2.2vw, 1.7rem);
}

.lead {
  max-width: 38rem;
  margin: 1.5rem 0 0;
  font-size: 1.15rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0 0;
}

.button {
  padding: 0.45rem 1.1rem 0.4rem;
  border: 2px solid var(--red);
  background: var(--red);
  color: var(--cream);
  font-family: var(--display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.button:hover {
  border-color: var(--night);
  background: var(--night);
  color: var(--cream);
}

.button.secondary {
  border-color: var(--night);
  background: none;
  color: var(--night);
}

.button.secondary:hover {
  background: var(--night);
  color: var(--cream);
}

.archive {
  padding: 2.5rem var(--gutter) 4rem;
  scroll-margin-top: 1rem;
}

.archive-header {
  display: grid;
  grid-template-columns: 1fr minmax(16rem, 24rem);
  gap: 0.5rem 2rem;
  align-items: end;
}

.archive-header h2 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3.75rem);
}

.browse {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.95rem;
}

.filter label {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.filter input {
  width: 100%;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--stage);
  color: var(--cream);
  font: inherit;
}

.filter p {
  min-height: 1.5em;
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.chapter h3 {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 3rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  font-size: 2rem;
}

.chapter h3 a {
  color: var(--cream);
  text-decoration: none;
}

.chapter h3 span {
  color: var(--muted);
  font-size: 1.15rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr));
  gap: 1.75rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.cover {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--stage);
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  transition: transform 0.35s ease;
}

.card a:hover .cover img {
  transform: scale(1.04);
}

.cover-text {
  display: grid;
  height: 100%;
  place-items: center;
  background: repeating-linear-gradient(
    115deg, var(--stage) 0 22px, #1f1c23 22px 44px
  );
  color: var(--muted);
  font-family: var(--display);
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-title {
  display: block;
  margin-top: 0.5rem;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.25;
}

.card a:hover .card-title {
  color: var(--sawdust);
}

.card-details {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* The justified photo grid. Each tile grows in proportion to its aspect ratio,
   so that a row fills the width and every photograph keeps its proportions. */
.photos {
  --row-height: clamp(9.5rem, 21vw, 19rem);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.photos::after {
  content: "";
  flex-grow: 1000000;
}

.photo {
  flex-grow: calc(var(--ratio) * 100);
  flex-basis: calc(var(--ratio) * var(--row-height));
  min-width: 0;
  max-width: 100%;
  aspect-ratio: var(--ratio);
  overflow: hidden;
  background: var(--stage);
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

.photo:hover img {
  opacity: 0.84;
}

.photos.solo {
  justify-content: center;
}

.photos.solo::after {
  display: none;
}

.photos.solo .photo {
  flex: 0 1 auto;
  width: min(100%, calc(var(--ratio) * 85vh));
}

/* The previews in the listings stay on one row at full proportions, and the
   right edge of the listing cuts off the photographs that do not fit. */
.photos.preview {
  --row-height: clamp(7rem, 12vw, 10.5rem);
  flex-wrap: nowrap;
  overflow: hidden;
}

.photos.preview::after {
  display: none;
}

.photos.preview .photo {
  flex: 0 0 auto;
  width: calc(var(--ratio) * var(--row-height));
  height: var(--row-height);
}

/* A post. */
.post-header, .listing-header {
  max-width: 54rem;
  padding: clamp(1.5rem, 5vh, 3.5rem) var(--gutter) 1.75rem;
}

.post-header h1, .listing-header h1 {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 5.25rem);
}

.page-number {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
}

.tag {
  padding: 0.05rem 0.55rem;
  border: 1px solid var(--line);
  color: var(--cream);
  font-size: 0.85rem;
  text-decoration: none;
}

.tag:hover {
  border-color: var(--sawdust);
  color: var(--sawdust);
}

.post-text {
  max-width: 40rem;
  margin-top: 1.25rem;
}

.post-text p {
  margin: 0 0 0.9rem;
}

.post-text p:last-child {
  margin-bottom: 0;
}

.verse {
  font-size: 1.2rem;
  line-height: 1.45;
}

.post .photos {
  padding: 0 clamp(5px, 1.2vw, 1rem);
}

.comments {
  max-width: 40rem;
  margin: 3rem auto 0;
  padding: 0 var(--gutter);
  box-sizing: content-box;
}

.comments h2 {
  margin: 0 0 1rem;
  font-size: 2rem;
}

.comments ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.comments li {
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 1rem;
}

.comments li:target {
  border-top-color: var(--sawdust);
}

.comments li p {
  margin: 0 0 0.5rem;
  overflow-wrap: anywhere;
}

.comments li p:last-child {
  margin-bottom: 0;
}

.comment-header time {
  margin-left: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.adjacent, .pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding: 1.5rem var(--gutter) 3rem;
  border-top: 1px solid var(--line);
}

.adjacent a, .pagination a {
  color: var(--cream);
  font-size: 1.05rem;
  line-height: 1.3;
  text-decoration: none;
}

.adjacent a:hover, .pagination a:hover {
  color: var(--sawdust);
}

.adjacent span {
  display: block;
  color: var(--muted);
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.adjacent .previous, .pagination .previous {
  grid-column: 1;
}

.adjacent .next, .pagination .next {
  grid-column: 2;
  text-align: right;
}

/* The listings. */
.entries {
  padding: 0 var(--gutter);
}

.entry {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}

.entry h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.9rem);
}

.entry h2 a {
  color: var(--cream);
  text-decoration: none;
}

.entry h2 a:hover {
  color: var(--sawdust);
}

.entry .photos {
  margin-top: 1rem;
}

.entry > p:last-child:not(.tags) {
  margin: 0.75rem 0 0;
}

.pagination {
  margin-top: 0;
}

/* The footer. */
.site-footer {
  padding: 2.5rem var(--gutter) 3rem;
  background: var(--stage);
  border-top: 4px solid var(--red);
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-columns {
  display: grid;
  grid-template-columns: minmax(16rem, 1.2fr) minmax(0, 2.4fr) minmax(8rem, 0.5fr);
  gap: 2.5rem;
}

.site-footer section {
  scroll-margin-top: 1rem;
}

.site-footer h2 {
  margin: 0 0 0.75rem;
  color: var(--cream);
  font-size: 1.6rem;
}

.site-footer p {
  margin: 0 0 0.75rem;
}

.feeds a {
  margin-right: 1rem;
}

.site-footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-tree > ul {
  columns: 3 11rem;
  column-gap: 2rem;
}

.category-tree > ul > li {
  margin-bottom: 0.5rem;
  break-inside: avoid;
}

.category-tree ul ul {
  padding-left: 0.85rem;
}

.count {
  font-size: 0.8rem;
}

/* The photo viewer. */
.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #000;
  color: var(--cream);
}

.lightbox::backdrop {
  background: #000;
}

.lightbox img {
  width: 100%;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  object-fit: contain;
}

.lightbox button {
  position: absolute;
  width: 3.25rem;
  height: 3.25rem;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 50%);
  color: var(--cream);
  font-family: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox button:hover {
  background: var(--red);
}

.lightbox button:disabled {
  visibility: hidden;
}

.lightbox-close {
  top: 0.75rem;
  right: 0.75rem;
}

.lightbox-previous, .lightbox-next {
  top: calc(50% - 1.625rem);
}

.lightbox-previous {
  left: 0.75rem;
}

.lightbox-next {
  right: 0.75rem;
}

.lightbox-counter {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  margin: 0;
  padding: 0 0.5rem;
  background: rgb(0 0 0 / 50%);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .footer-columns {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

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

/* The title has too little room beside the photograph on narrow windows, so
   the photograph moves above it. */
@media (max-width: 1200px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding-top: 6rem;
    background: #f4f4f4;
  }

  .hero img {
    position: static;
    width: 100%;
    height: auto;
    -webkit-mask-image: linear-gradient(transparent, #000 12%);
    mask-image: linear-gradient(transparent, #000 12%);
    transform: none;
  }

  /* The text continues the studio floor at the bottom of the photograph. */
  .hero-text {
    max-width: none;
    padding-top: 1rem;
    background: #c4c3c1;
  }

  .hero h1 {
    font-size: clamp(2.6rem, 11vw, 7rem);
  }
}

@media (max-width: 540px) {
  .site-header nav {
    gap: 1rem;
  }

  .lightbox-previous, .lightbox-next {
    top: auto;
    bottom: 0.75rem;
  }
}

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

  .cover img, .photo img {
    transition: none;
  }
}
