/*
 * Devotion Gallery archive: the only stylesheet.
 *
 * Keeps the 2009–2014 site's look (black page, dark panels with small
 * uppercase heading bars, grey spaced-out navigation, cyan links) on
 * modern, accessible CSS.
 *
 * Order: 1 Tokens, 2 Base, 3 Shared patterns, 4 Site frame,
 * 5 Page parts, 6 Small screens.
 */

/* 1. Tokens */

:root {
  /* Colours, taken from the old Squarespace stylesheet and screenshots. */
  --colour-page: #000;
  --colour-panel: #1e1818;
  --colour-panel-bar: #2b2525;
  --colour-line: #3a3434;
  --colour-text: #d1cfcf;
  --colour-text-strong: #fff;
  --colour-muted: #a9a5a5;
  --colour-link: #5ec8de;
  --colour-link-hover: #fff;

  /* The old site's pink, used only for the keyboard focus ring. */
  --focus: #e83595;

  /* Fonts: the old site used Verdana for text and Helvetica for labels. */
  --font-text: verdana, geneva, "DejaVu Sans", sans-serif;
  --font-label: "Helvetica Neue", helvetica, arial, sans-serif;

  /* Type scale, in rem so it follows the reader's font size. */
  --text-xs: 0.6875rem;
  --text-s: 0.8125rem;
  --text-m: 0.9375rem;
  --text-l: 1.125rem;
  --leading: 1.6;
  --tracking-label: 0.14em;

  /* Spacing, on a 4px scale. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  /* Layout widths. The old site was about 930px wide. */
  --width-site: 58rem;
  --width-sidebar: 14rem;
  --width-prose: 42rem;
  --size-thumb: 12rem;
  --size-photo: 13rem;

  /* The viewer's backdrop: near-black so photos stand out. */
  --colour-backdrop: rgb(0 0 0 / 92%);
}

/* 2. Base: element defaults, kept weak with :where() so patterns win. */

/* A bare * has no specificity, so this reset never outranks a pattern. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:where(html) {
  background: var(--colour-page);
  color: var(--colour-text);
  font-family: var(--font-text);
  font-size: 100%;
  line-height: var(--leading);
}

:where(body) {
  margin: 0;
  font-size: var(--text-m);
}

:where(img) {
  max-width: 100%;
  height: auto;
}

:where(a) {
  color: var(--colour-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

:where(a:hover) {
  color: var(--colour-link-hover);
}

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

:where(h1, h2, h3, h4) {
  color: var(--colour-text-strong);
  line-height: 1.3;
}

:where(hr) {
  border: 0;
  border-top: 1px solid var(--colour-line);
}

/* 3. Shared patterns */

/* Small uppercase label type: navigation, heading bars, dates. */
.label,
.panel-title,
.site-nav a,
.sidebar-title,
.post-date {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* A dark panel with a heading bar, as on the old site. */
.panel {
  background: var(--colour-panel);
  border: 1px solid var(--colour-line);
}

.panel-title {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--colour-panel-bar);
  border-bottom: 1px solid var(--colour-line);
  color: var(--colour-text-strong);
}

.panel-body {
  padding: var(--space-4) var(--space-4) var(--space-6);
}

/* Hidden visually but still read by screen readers. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 4. Site frame */

/* Skip link: off screen until it gets keyboard focus. */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--colour-text-strong);
  color: var(--colour-page);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.site-header,
.layout,
.site-footer {
  width: min(100% - 2 * var(--space-4), var(--width-site));
  margin-inline: auto;
}

.site-header {
  padding-block: var(--space-4) var(--space-3);
}

.site-logo {
  display: inline-block;
}

.site-logo img {
  display: block;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-6);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--colour-muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--colour-text-strong);
}

/* Main column, with the section list beside it on wide screens. */
.layout {
  display: grid;
  gap: var(--space-4);
}

.layout-with-sidebar {
  grid-template-columns: var(--width-sidebar) minmax(0, 1fr);
}

/* The sidebar comes after the content in the page, but sits on the left. */
.layout-with-sidebar main {
  grid-column: 2;
  grid-row: 1;
}

.sidebar {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  background: var(--colour-panel);
  border: 1px solid var(--colour-line);
}

.sidebar-title {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--colour-panel-bar);
  border-bottom: 1px solid var(--colour-line);
}

.link-list {
  margin: 0;
  padding: var(--space-2) var(--space-3) var(--space-3);
  list-style: none;
  font-size: var(--text-s);
  line-height: 1.4;
}

.link-list li {
  padding-block: var(--space-1);
}

.link-list a {
  text-decoration: none;
}

.site-footer {
  padding-block: var(--space-8);
  color: var(--colour-muted);
  font-size: var(--text-xs);
}

/* 5. Page parts */

/* Home: the memorial image, alone on black, as the old site left it. */
.memorial {
  display: block;
  margin-block: var(--space-8);
}

.memorial img {
  display: block;
}

/* Posts. */
.post-date {
  margin: 0 0 var(--space-4);
  color: var(--colour-muted);
}

.prose {
  max-width: var(--width-prose);
  overflow-wrap: break-word;
}

.prose h2,
.prose h3,
.prose h4 {
  margin-block: var(--space-6) var(--space-2);
  font-size: var(--text-m);
}

/* Old posts show rows of linked thumbnails: keep each row together, side by side,
   with the text that follows starting on its own line. */
.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-block: var(--space-3);
}

.prose a img {
  cursor: zoom-in;
  vertical-align: top;
  margin: 0 var(--space-1) var(--space-1) 0;
}

.prose dd {
  margin-inline-start: var(--space-4);
}

/* Video embeds keep a 16:9 frame at any width. */
.video {
  margin-block: var(--space-4);
}

.video iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.credit {
  margin-top: var(--space-6);
  color: var(--colour-muted);
  font-size: var(--text-s);
}

/* Themes and tags at the foot of a post. */
.terms {
  margin-top: var(--space-6);
  font-size: var(--text-s);
}

.terms p {
  margin: 0 0 var(--space-1);
}

.terms-heading {
  color: var(--colour-muted);
}

/* Lead image across the top of a post. */
.hero {
  display: block;
  background: var(--colour-page);
}

.hero img {
  display: block;
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

/* Photos from the show, and related lists (artists, shows). */
.photos,
.related {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid var(--colour-line);
}

.photos h2,
.related h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-m);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--size-photo), 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.photo-grid a {
  display: block;
}

.photo-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Videos hosted with the site. */
.video-file {
  margin: var(--space-6) 0 0;
}

.video-file video {
  display: block;
  width: 100%;
  background: var(--colour-page);
}

.video-file figcaption,
.press-image figcaption {
  margin-top: var(--space-1);
  color: var(--colour-muted);
  font-size: var(--text-s);
}

/* The article image at the top of a press post. */
.press-image {
  margin: 0;
  padding: var(--space-4) var(--space-4) 0;
}

/* The blog: every post, one after another. */
.flow-post + .flow-post {
  margin-top: var(--space-8);
}

.flow-post .panel-title a {
  color: inherit;
  text-decoration: none;
}

.flow-post .panel-title a:hover {
  text-decoration: underline;
}

/* Photo viewer (assets/js/lightbox.js): a full-screen dialog. */
.viewer {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: var(--space-12) var(--space-4) var(--space-4);
  border: 0;
  background: transparent;
  color: var(--colour-text);
}

.viewer::backdrop {
  background: var(--colour-backdrop);
}

.viewer-figure {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0;
}

.viewer-image {
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  object-fit: contain;
}

.viewer-caption {
  margin-top: var(--space-2);
  font-size: var(--text-s);
  text-align: center;
}

.viewer-button {
  position: fixed;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--colour-line);
  background: var(--colour-panel-bar);
  color: var(--colour-text-strong);
  font: inherit;
  font-size: var(--text-s);
  cursor: pointer;
}

.viewer-close {
  top: var(--space-3);
  right: var(--space-3);
}

.viewer-previous {
  top: 50%;
  left: var(--space-3);
}

.viewer-next {
  top: 50%;
  right: var(--space-3);
}

/* Previous and next links under a post. */
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  margin-top: var(--space-3);
  font-size: var(--text-s);
}

.pager-next {
  margin-left: auto;
  text-align: right;
}

/* Section lists: a grid of thumbnails with titles and dates. */
.panel-body > h2 {
  margin: var(--space-6) 0 var(--space-3);
  font-size: var(--text-l);
}

.panel-body > h2:first-child {
  margin-top: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--size-thumb), 1fr));
  gap: var(--space-6) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.card img,
.card-blank {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--colour-panel-bar);
}

.card-title {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-s);
  line-height: 1.4;
}

.card a:hover .card-title {
  text-decoration: underline;
}

.card time {
  display: block;
  color: var(--colour-muted);
  font-size: var(--text-xs);
}

/* Artists page: names without a picture, in columns under the grid. */
.more-artists {
  margin-top: var(--space-8);
}

.name-list {
  columns: 12rem;
  column-gap: var(--space-6);
  padding: 0;
  font-size: var(--text-m);
}

.name-list li {
  break-inside: avoid;
}

/* 6. Small screens */

@media (width <= 48rem) {
  /* One column: the section list moves below the post. */
  .layout-with-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }

  .layout-with-sidebar main,
  .sidebar {
    grid-column: 1;
    grid-row: auto;
  }

  .site-nav ul {
    gap: var(--space-2) var(--space-4);
  }

  .panel-body {
    padding: var(--space-3) var(--space-3) var(--space-4);
  }
}
