:root {
  --bg: #14140f;
  --surface: #1e1e18;
  --border: #34342c;
  --ink: #ece8dc;
  --muted: #9a9585;
  --accent: #c9a227;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1.5rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 "Iowan Old Style", Palatino, Georgia, serif;
}

.masthead {
  max-width: 76rem;
  margin: 0 auto;
  padding: 2.5rem 0 1.75rem;
  border-bottom: 1px solid var(--border);
}

.masthead h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.masthead h1 a { color: var(--ink); text-decoration: none; }

.breadcrumb { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.9rem; }
.breadcrumb a { color: var(--muted); }

.crumb-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 0.6rem;
}

.crumb-row .breadcrumb { margin: 0; }

.grid-tools {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.grid-tools .sort a { margin-left: 0.5rem; color: var(--muted); }
.grid-tools .sort a.current { color: var(--accent); text-decoration: none; }

.grid-tools input {
  width: 11rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.categories { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }

.categories a {
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
}

.categories a.current { border-color: var(--accent); color: var(--accent); }

main { max-width: 76rem; margin: 0 auto; }

.empty { color: var(--muted); padding: 4rem 0; text-align: center; }

.albums, .grid {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.75rem;
}

.albums { grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 17rem)); justify-content: center; }
.grid { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }

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

.albums img, .grid img {
  display: block;
  width: 100%;
  height: 11rem;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
}

.albums a:hover img, .grid a:hover img { border-color: var(--accent); }

.grid a { position: relative; display: block; }

.grid a.video::after {
  content: "\25B6";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  font-size: 1rem;
  display: grid;
  place-items: center;
  padding-left: 0.2rem;
  pointer-events: none;
}

.album-name { display: block; margin-top: 0.6rem; letter-spacing: 0.04em; }
.album-count { display: block; color: var(--muted); font-size: 0.82rem; }

.grid figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

#viewer {
  max-width: min(94vw, 1200px);
  max-height: 94vh;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}

#viewer::backdrop { background: rgb(0 0 0 / 0.85); }
#viewer img, #viewer video { display: block; max-width: 100%; max-height: 78vh; }
#viewer video {
  width: min(94vw, 1200px);
  background: #000;
  border-top: 1rem solid #000;
  border-bottom: 1rem solid #000;
}
#viewer [hidden] { display: none; }
.viewer-text { padding: 0.9rem 1.2rem 1.2rem; }
.viewer-text h2 { margin: 0; font-size: 1.05rem; font-weight: 400; }
.viewer-text p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.9rem; }

.video-commentary { margin-top: 2.5rem; }

.video-commentary .artwork { display: block; margin-top: 1.75rem; }

.video-commentary .artwork img {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
}

.video-commentary .artwork:hover img { border-color: var(--accent); }

.page-panels {
  display: flex;
  gap: 1.75rem;
  margin-top: 0;
  align-items: flex-start;
}

.page-videos { flex: 0 0 26.5rem; max-width: 26.5rem; }

.page-videos video {
  display: block;
  width: 100%;
  background: #000;
  border: 1px solid var(--border);
  cursor: pointer;
}

.page-videos video + video { margin-top: 1rem; }

.page-videos video:hover { border-color: var(--accent); }

.page-title {
  margin: 2rem 0 0;
  font-size: 2.8rem;
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.page-hint { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.82rem; }

.page-commentary { flex: 1; min-width: 0; }

.commentary-box {
  height: 31rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
}

.commentary-box img { display: block; width: 100%; }

.story .page-title { margin-top: 0; }

.story-hint { margin: 0.5rem 0 1.25rem; font-size: 1rem; }

.story-part { margin-top: 2.5rem; }

.story-part .page-videos { position: sticky; top: 1rem; }

.story-part .commentary-box { height: auto; overflow: visible; }

.part-label {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 56rem) {
  .story-part .page-videos { position: static; }
  .page-panels { flex-direction: column; }
  .page-videos { flex-basis: auto; max-width: 100%; }
  .page-commentary { width: 100%; }
}

#viewer form { position: absolute; top: 0; right: 0; }

#viewer button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.8rem;
  line-height: 1;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}

body.home { height: 100vh; display: flex; flex-direction: column; padding-bottom: 1.5rem; }

body.home .masthead, main.home { width: 100%; }

main.home { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.featured { flex: 1; display: flex; flex-direction: column; min-height: 14rem; margin: 2rem 0 0; }

.featured .artwork { flex: 1; min-height: 0; display: block; }

.featured img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--border);
}

.featured .artwork:hover img { border-color: var(--accent); }

.featured figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
