/* Shared styles for all three pages. */
body {
  margin: 0;
  background: #fff;
  color: #333;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

main {
  width: calc(100% - 48px);
  max-width: 540px;
  margin: 160px auto 80px;
}

h1 {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.25;
}

.page-navigation {
  margin-bottom: 24px;
}

/* A plain, text-first homepage inspired by Daniel Gross. */
.home {
  max-width: 600px;
  margin-top: 80px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.5;
}

.home h1 {
  margin-bottom: 14px;
  font-size: 32px;
}

.home-intro {
  line-height: 1.7;
}

.home-section {
  margin-top: 36px;
}

.home-section h2 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 400;
  color: #666;
}

.experience-list,
.home-links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.experience-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 24px;
  margin-bottom: 20px;
}

.experience-date {
  color: #777;
}

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

.publication-list li {
  margin-bottom: 20px;
}

.publication-authors {
  display: block;
  color: #666;
}

.home-links li {
  margin-bottom: 8px;
}

.home a {
  text-decoration-color: #aaa;
  text-underline-offset: 3px;
}

p {
  margin: 0 0 16px;
}

nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: underline;
}

a:hover {
  color: #000;
}

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

h2 {
  margin: 24px 0 16px;
  font-size: 18px;
}

.library {
  max-width: 1040px;
}

.book-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px 12px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}

.book-list li {
  min-width: 0;
}

.book-cover,
.collection-detail-cover {
  aspect-ratio: 2 / 3;
}

.book-cover img,
.collection-detail-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px 12px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}

.collection-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.collection-button:focus-visible,
.collection-detail-close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 5px;
}

.collection-is-open {
  overflow: hidden;
}

.collection-detail {
  box-sizing: border-box;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 80px 32px;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: auto;
}

.collection-detail::backdrop {
  background: rgba(255, 255, 255, 0.96);
}

.collection-detail[open] {
  display: flex;
}

.collection-detail-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: center;
  gap: 56px;
  width: 100%;
  max-width: 780px;
  margin: auto;
}

.collection-detail-cover {
  transform-origin: top left;
}

.collection-detail-cover a {
  display: block;
  height: 100%;
}

.collection-detail-text {
  min-width: 0;
  overflow-wrap: anywhere;
  animation: collection-text-in 300ms ease-out both;
}

.collection-detail-text h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

#collection-detail-takeaway {
  margin: 0;
  white-space: pre-line;
  line-height: 1.7;
}

.collection-detail-close {
  position: fixed;
  top: 24px;
  right: 32px;
  border: 0;
  padding: 8px;
  color: inherit;
  background: #fff;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

@keyframes collection-text-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .collection-detail-text {
    animation: none;
  }
}

.movie-grid li {
  min-width: 0;
}

.movie-poster {
  min-width: 0;
  aspect-ratio: 2 / 3;
}

.collection-credit {
  margin: 0 0 12px;
  color: #666;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.movie-grid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.movie-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 100%;
  padding: 12px;
  background: #f4f4f4;
  color: #666;
  text-align: center;
}

@media (max-width: 600px) {
  .book-list,
  .movie-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .experience-list li {
    grid-template-columns: 1fr;
  }

  .collection-detail {
    padding: 80px 24px 40px;
  }

  .collection-detail-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    gap: 24px;
  }

  .collection-detail-text h2 {
    font-size: 19px;
  }

  main {
    margin: 64px auto;
  }
}

@media (max-width: 400px) {
  .book-list,
  .movie-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
