:root { color-scheme: light dark; }

body {
  font-family: system-ui, sans-serif;
  line-height: 1.4;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

a { color: LinkText; }

header h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
header p  { margin: 0 0 1rem; opacity: .8; }

/* Filter / sort bar */
nav.controls { margin: 0 0 1rem; font-size: .9rem; }
nav.controls a, nav.controls button {
  display: inline-block;
  margin: 0 .5rem .35rem 0;
  padding: .1rem .4rem;
  font: inherit;
  color: inherit;
  background: none;
  border: 1px solid GrayText;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}
nav.controls button[aria-pressed="true"] { border-color: currentColor; font-weight: 600; }
nav.controls select { font: inherit; padding: .15rem .25rem; margin-right: 1.25rem; }
nav.controls .sort { white-space: nowrap; }

/* Masonry: pure CSS columns, natural image dimensions.
   Width-driven on tablet/desktop; never fewer than 2 columns on phones (WikiArt-style). */
.gallery { column-width: 250px; column-gap: 14px; }
@media (max-width: 560px) {
  /* column-width must go to auto, or it still caps the count at 1 on a narrow screen */
  .gallery { column-width: auto; column-count: 2; column-gap: 10px; }
  .work { margin-bottom: 10px; }
}
.work {
  display: inline-block;
  width: 100%;
  break-inside: avoid;
  margin: 0 0 14px;
  text-decoration: none;
  color: inherit;
}
.work figure { margin: 0; }
.work img { width: 100%; height: auto; display: block; border-radius: 3px; }
.work figcaption { padding: .25rem 0 0; font-size: .85rem; }
.work figcaption small { display: block; opacity: .6; }

/* Video tile play marker (no animation) */
.work .play { position: relative; }
.work .play::after {
  content: "\25B6";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: #fff;
  text-shadow: 0 0 6px rgba(0,0,0,.8);
}

/* Detail page */
nav.crumb { font-size: .9rem; margin: 0 0 1rem; opacity: .8; }
/* keep the image within a typical browser window — no full-page scroll for tall images */
.detail img { max-width: 100%; max-height: 80vh; width: auto; height: auto; display: block; border-radius: 3px; }
.detail .embed { position: relative; padding-top: 56.25%; }
.detail .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.detail dl { display: grid; grid-template-columns: max-content 1fr; gap: .15rem .75rem; font-size: .9rem; margin: 1rem 0; }
.detail dt { opacity: .6; }
.detail dd { margin: 0; }
.detail .desc { max-width: 60ch; }
nav.prevnext { margin-top: 2rem; font-size: .9rem; display: flex; justify-content: space-between; gap: 1rem; }
