:root {
  --background: #16120e;
  --panel: #231c15;
  --shelf: #4a3423;
  --shelf-edge: #2e2015;
  --text: #f2e9dc;
  --muted: #b3a491;
  --accent: #e0a458;
  --accent-text: #1c1408;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.header {
  padding: 24px 24px 0;
}

.views {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
}

.views h1,
.view-title {
  display: inline-block;
  margin: 0;
  padding: 0 0 4px;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: inherit;
  color: var(--accent);
  letter-spacing: 0.02em;
  cursor: default;
  user-select: none;
}

.view-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  padding: 0 0 4px;
  border-bottom: 2px solid transparent;
  line-height: inherit;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.view-link:hover {
  color: var(--accent);
}

.view-link.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.view-sep {
  display: inline-block;
  padding: 0 0 4px;
  border-bottom: 2px solid transparent;
  line-height: inherit;
  color: #4b3e30;
  user-select: none;
}

#genres {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 16px 24px 2px;
  margin-bottom: 20px;
}

#genres:has(+ #toggle-genres:not([hidden])) {
  margin-bottom: 0;
}

#genres.collapsed {
  max-height: 122px;
  overflow: hidden;
}

#toggle-genres {
  display: block;
  margin: 6px 24px 20px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

#toggle-genres[hidden] { display: none; }

#toggle-genres:hover { text-decoration: underline; }

#genres button {
  padding: 5px 11px;
  border: 1px solid #4b3e30;
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#genres button:hover { border-color: var(--accent); }

#genres button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

#genres button span { opacity: 0.65; }

#shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 28px 22px;
  padding: 32px 24px 48px;
}

body.has-genres #shelf {
  padding-top: 8px;
}

/* Fallback for when genres nav is hidden via inline style or empty */
#genres[style*="display: none"] ~ #shelf,
#genres:empty ~ #shelf {
  padding-top: 32px;
}

/* Card shared styling */
.item-card {
  min-width: 0;
  padding-bottom: 8px;
  border-bottom: 10px solid var(--shelf);
  box-shadow: 0 5px 0 var(--shelf-edge);
}

/* Album sleeve: square */
.sleeve {
  aspect-ratio: 1;
  margin: 0;
  overflow: hidden;
  border-radius: 3px;
  background: var(--panel);
  box-shadow: 0 6px 14px rgb(0 0 0 / 55%);
}

/* Movie poster: 2/3 ratio */
.sleeve.poster {
  aspect-ratio: 2 / 3;
}

.sleeve img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Four lines: two for title, one each for artist/director and year */
.info {
  height: 5.2em;
  margin-top: 10px;
  overflow: hidden;
  font-size: 0.8rem;
  line-height: 1.3;
}

.info strong {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.info span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.links {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 0.8rem;
  line-height: 1.2;
}

.links a,
.links span.link-item {
  color: #8c7b69;
  text-decoration: none;
  text-transform: lowercase;
  transition: color 0.15s ease;
}

.links a:hover,
.links a:focus-visible {
  color: var(--accent);
}

/* Streaming & Database brand link hover colors */
.links a.spotify:hover,
.links a.spotify:focus-visible { color: #1ed760; }

.links a.tidal:hover,
.links a.tidal:focus-visible { color: #fff; }

.links a.imdb:hover,
.links a.imdb:focus-visible { color: #f5c518; }

.links a.letterboxd:hover,
.links a.letterboxd:focus-visible { color: #00e054; }

.links .link-sep {
  color: #4b3e30;
  margin: 0 6px;
  user-select: none;
}

.links .missing {
  color: #4b3e30;
  cursor: default;
}

.notice {
  grid-column: 1 / -1;
  color: var(--muted);
}

@media (max-width: 600px) {
  .header {
    padding: 16px 16px 0;
  }

  .views {
    font-size: 1rem;
    gap: 8px;
  }

  #genres { padding-inline: 16px; }

  #toggle-genres { margin-inline: 16px; }

  #shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 14px;
    padding-inline: 16px;
    padding-top: 24px;
  }

  body.has-genres #shelf {
    padding-top: 8px;
  }
}
