:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #ffffff;
  --text: #1f1f1f;
  --muted: #5f5a52;
  --line: #ddd4c7;
  --accent: #6f4e37;
  --letter-thumb-width: 280px;
  --card-thumb-width: 520px;
  --thumb-gap: 1rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background: var(--bg);
}

main {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

header {
  margin-bottom: 2rem;
  text-align: center;
}

h1,
h2,
p {
  margin: 0;
}

.year-list {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
}

.year-entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  max-width: 100%;
}

.year-entry h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  align-self: flex-start;
}

.media-grid {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: var(--thumb-gap);
  align-items: center;
  width: fit-content;
  max-width: 100%;
}

.figure-link,
.figure-image {
  display: block;
}

.figure-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.figure-link img,
.figure-image img {
  display: block;
  height: 320px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.figure-link:hover img,
.figure-link:focus-visible img {
  border-color: var(--accent);
}

.figure-link:not(.card-link) img {
  width: auto;
  max-width: min(100%, var(--letter-thumb-width));
  border: 0;
  background: transparent;
}

.card-link img {
  width: auto;
  max-width: min(100%, var(--card-thumb-width));
  border: 0;
}

.card-link:hover img,
.card-link:focus-visible img {
  border-color: transparent;
}

.entry-note {
  margin-top: 1rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: calc(var(--letter-thumb-width) + var(--card-thumb-width) + var(--thumb-gap));
  text-align: center;
}

.entry-note a {
  color: inherit;
}

.video-wrap {
  margin-top: 1rem;
  aspect-ratio: 16 / 9;
  width: min(100%, calc(var(--letter-thumb-width) + var(--card-thumb-width) + var(--thumb-gap)));
}

.video-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 10px;
}

.viewer-page {
  background: #ffffff;
}

.viewer-page main {
  width: min(1200px, calc(100% - 2rem));
}

.viewer-back {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
}

.viewer-frame {
  background: #ffffff;
  border-radius: 14px;
  padding: 1rem;
}

.viewer-frame img {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

@media (max-width: 640px) {
  main {
    width: min(100% - 1rem, 1100px);
    padding-top: 1rem;
  }

  .year-entry {
    padding: 1rem;
  }

  .media-grid {
    grid-template-columns: 1fr;
    align-items: start;
    width: 100%;
  }

  .figure-link:not(.card-link) img,
  .card-link img {
    width: 100%;
    max-width: 100%;
  }
}
