.education-page {
  letter-spacing: 0;
}

.education-frame {
  --max-width: 48rem;
}

.education-page .page-title {
  font-size: 3.2rem;
  letter-spacing: -0.04em;
}

.education-page .page-intro {
  max-width: 42rem;
  font-size: 1.08rem;
}

.education-section__number,
.material__action,
.material figcaption {
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

.education-prose {
  max-width: 42rem;
}

.education-prose p {
  margin-bottom: 1.15rem;
  font-size: 1.03rem;
  line-height: 1.75;
}

.education-index {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 2.6rem 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.education-index a {
  min-width: 0;
  padding: 0.8rem 0.7rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.education-index a + a {
  border-left: 1px solid var(--line);
}

.education-index a:hover,
.education-index a:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
}

.education-section {
  padding: 4.8rem 0 1rem;
  scroll-margin-top: 1rem;
}

.education-section + .education-section {
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.education-section__number {
  margin: 0 0 0.7rem;
  color: var(--accent);
  font-size: 0.78rem;
}

.education-section h2 {
  margin: 0 0 0.55rem;
  font-size: 1.55rem;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.education-section__intro {
  max-width: 40rem;
  margin: 0;
  color: var(--text-soft);
  font-size: 0.98rem;
  line-height: 1.65;
}

.materials-grid {
  display: grid;
  gap: 2.5rem 1rem;
  margin-top: 2rem;
}

.materials-grid + .materials-grid {
  margin-top: 3.4rem;
}

.materials-grid--posters,
.materials-grid--details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.materials-grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.materials-grid--narrow {
  width: min(100%, 30rem);
  margin-right: auto;
  margin-left: auto;
}

.material {
  min-width: 0;
  margin: 0;
}

.material--wide {
  grid-column: 1 / -1;
}

.material__button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: zoom-in;
}

.material__button:focus {
  outline: none;
}

.material__button:focus-visible {
  outline: 2px solid rgba(112, 202, 215, 0.45);
  outline-offset: 4px;
}

.material__frame {
  display: block;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f7f7f8;
}

.material__frame--poster {
  aspect-ratio: 4 / 5;
}

.material__frame--landscape {
  aspect-ratio: 16 / 9;
}

.material__frame--portrait {
  aspect-ratio: 4 / 5;
}

.material__frame--reference {
  aspect-ratio: 844 / 1732;
}

.material__frame--contain {
  aspect-ratio: 4 / 3;
}

.material__frame--strip {
  aspect-ratio: 16 / 5;
}

.material__stack {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f7f7f8;
}

.material__stack .material__frame {
  border: 0;
  border-radius: 0;
}

.material__stack .material__frame + .material__frame {
  border-top: 1px solid var(--line);
}

.material__frame--instructor-heading {
  aspect-ratio: 1488 / 292;
}

.material__frame--instructor {
  aspect-ratio: 1512 / 1038;
}

.material__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: opacity 160ms ease;
}

.material__frame--contain img,
.material__frame--strip img,
.material__frame--reference img,
.material__frame--instructor-heading img,
.material__frame--instructor img {
  object-fit: contain;
}

.material__button:hover .material__frame img {
  opacity: 0.88;
}

.material__action {
  display: block;
  margin-top: 0.55rem;
  color: var(--accent);
  font-size: 0.76rem;
}

.material figcaption {
  margin-top: 0.62rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
}

.education-end {
  max-width: 42rem;
  color: var(--text-soft);
}

.education-end p {
  margin: 0 0 1rem;
}

.education-end a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

body.viewer-open {
  overflow: hidden;
}

.material-viewer[hidden] {
  display: none;
}

.material-viewer {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(255, 255, 255, 0.985);
}

.material-viewer__bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 3.25rem;
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 1rem;
  background: var(--surface);
}

.material-viewer__bar p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-viewer__bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.material-viewer__bar button:hover,
.material-viewer__bar button:focus-visible {
  color: var(--accent);
}

.material-viewer__scroll {
  min-height: 0;
  overflow: auto;
  padding: 1rem 1rem 5rem;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.material-viewer__scroll img {
  width: min(100%, 62.5rem);
  height: auto;
  margin: 0 auto;
  background: #fff;
}

.material-viewer__scroll img + img {
  margin-top: 0;
}

@media (max-width: 640px) {
  .education-page .page-title {
    font-size: 2.45rem;
    line-height: 1.12;
  }

  .education-page .page-intro,
  .education-prose p {
    font-size: 1rem;
  }

  .education-index {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .education-index a:nth-child(3),
  .education-index a:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .education-index a:nth-child(3) {
    border-left: 0;
  }

  .education-section {
    padding-top: 3.8rem;
  }

  .materials-grid--posters,
  .materials-grid--details {
    grid-template-columns: minmax(0, 1fr);
  }

  .material--wide {
    grid-column: auto;
  }

  .material__frame--poster,
  .material__frame--portrait {
    aspect-ratio: 4 / 5;
  }

  .material-viewer__scroll {
    padding: 0.6rem 0.55rem 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .material__frame img {
    transition: none;
  }
}
