:root {
  --background: #e4f6f1;
  --surface: #f5fcf9;
  --tint: #d3eae0;
  --text: #334b3e;
  --primary: #19492e;
  --accent: #a71c6c;
  --duration: 400ms;
}

html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

html:has(dialog:modal) {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 64px;
  background: var(--background);
  color: var(--text);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.5;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--primary);
  overflow-wrap: anywhere;
}

h1 {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.3;
}

h3 {
  font-weight: 600;
}

a {
  color: var(--primary);
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}

button {
  color: inherit;
  font-size: inherit;
  font-weight: 500;
  line-height: inherit;
  cursor: pointer;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

strong,
b {
  font-weight: 700;
}

[hidden] {
  display: none !important;
}

:where(a, button, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.content-frame {
  width: calc(100% - 76px);
  max-width: 1310px;
  margin-inline: auto;
  padding-inline: 0;
}

.masthead {
  position: static;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--primary);
}

.home-link {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding-block: 10px;
  text-decoration: none;
}

.home-link img {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.site-title {
  min-width: 0;
  font-size: 24px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.publication {
  font-size: 14px;
  font-weight: 500;
  text-align: right;
}

.jump {
  position: fixed;
  top: 12px;
  left: 38px;
  z-index: 20;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.jump:focus {
  width: auto;
  height: auto;
  max-width: calc(100% - 76px);
  margin: 0;
  padding: 12px 16px;
  clip-path: none;
  overflow: visible;
  background: var(--surface);
  border: 1px solid var(--primary);
  white-space: normal;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.glyph {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-button,
.close-button,
.direction-button {
  width: 44px;
  min-height: 44px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--primary);
  border-radius: 0;
  background: transparent;
}

.nav-button {
  display: none;
}

.close-button,
.direction-button {
  display: inline-flex;
}

main.content-frame {
  flex: 1;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  column-gap: 34px;
  align-items: start;
}

.navigation-panel {
  min-width: 0;
  padding-top: 20px;
  border-top: 3px double var(--primary);
}

.navigation-title {
  margin-bottom: 20px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.menu-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 0 0 12px;
  border-left: 1px solid var(--primary);
  list-style: none;
}

.menu-links li {
  min-width: 0;
}

.menu-links a {
  display: block;
  padding: 12px;
  border: 1px solid var(--primary);
  background: transparent;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}

.menu-links a[aria-current="page"],
.footer-links a[aria-current="page"] {
  border-left: 4px solid var(--accent);
  background: var(--surface);
}

.menu-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100%;
  margin: 0;
  padding: 28px 38px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  color: var(--text);
  background: var(--background);
}

.menu-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.menu-dialog::backdrop {
  background: var(--primary);
}

.menu-dialog.is-opening {
  animation: menu-slide var(--duration) ease both;
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 3px double var(--primary);
}

.dialog-heading h2 {
  min-width: 0;
  font-size: 26px;
}

.dialog-navigation {
  min-width: 0;
}

.menu-dialog .menu-links a {
  padding: 16px;
  font-size: 18px;
}

.page-sections {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 64px;
}

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  align-items: end;
  gap: 24px;
}

.lead {
  min-width: 0;
}

.lead p {
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.welcome-art {
  width: 140px;
  height: 140px;
}

.topics,
.library,
.feature {
  min-width: 0;
  display: grid;
  gap: 24px;
}

.section-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 3px double var(--primary);
}

.section-top h2 {
  min-width: 0;
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.story-label {
  display: inline-block;
  max-width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--primary);
  background: var(--tint);
  color: var(--primary);
  font-size: 16px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

#stories {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 0;
  list-style: none;
}

.story {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--primary);
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--primary);
  text-align: right;
}

.story h3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
}

.story-meta {
  color: var(--primary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow-wrap: anywhere;
}

.outline-link,
.playback-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid var(--primary);
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
}

.story .outline-link {
  width: 100%;
}

.slider {
  min-width: 0;
  display: grid;
  gap: 24px;
  padding: 20px;
  border: 1px solid var(--primary);
  background: var(--tint);
  box-shadow: 6px 6px 0 var(--primary);
}

.slide-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  list-style: none;
}

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

.slide-choice {
  width: 100%;
  height: 100%;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--primary);
  border-bottom: 3px solid var(--primary);
  border-radius: 0;
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  overflow-wrap: anywhere;
}

.slide-choice[aria-pressed="true"] {
  border-bottom-color: var(--accent);
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
}

.slide-stage {
  min-width: 0;
}

.slide-panel {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 35fr) minmax(0, 65fr);
  align-items: center;
}

.slide-visual {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--background);
  border: 1px solid var(--primary);
}

.slide-visual img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.slide-copy {
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 24px;
  padding: 20px 0 20px 28px;
}

.slide-copy h3 {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.3;
}

.slide-panel.is-fading-out .slide-visual {
  animation: image-out calc(var(--duration) / 2) ease both;
}

.slide-panel.is-fading-in .slide-visual {
  animation: image-in calc(var(--duration) / 2) ease both;
}

.slider-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 20px;
  border-top: 3px double var(--primary);
}

.direction-controls {
  display: flex;
  gap: 12px;
}

.motion-note {
  flex-basis: 100%;
  font-size: 14px;
}

.story-page {
  width: 100%;
  max-width: 620px;
  min-width: 0;
  margin-left: auto;
  margin-right: 0;
  display: grid;
  gap: 32px;
}

.reading-heading {
  min-width: 0;
  display: grid;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 3px double var(--primary);
}

.trail {
  font-size: 14px;
  line-height: 1.5;
}

.trail ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 0;
  list-style: none;
}

.trail li {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  overflow-wrap: anywhere;
}

.trail li[aria-current="page"] {
  flex: 1 1 180px;
}

.trail li span:last-child {
  min-width: 0;
}

.reading {
  min-width: 0;
  overflow-wrap: anywhere;
}

.reading > :first-child {
  margin-top: 0;
}

.reading > :last-child {
  margin-bottom: 0;
}

.reading p {
  margin-block: 0 24px;
}

.reading h2 {
  margin-block: 48px 20px;
  padding-top: 20px;
  border-top: 3px double var(--primary);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.3;
}

.reading h3 {
  margin-block: 32px 16px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.4;
}

.reading blockquote {
  margin: 32px 0;
  padding: 24px;
  border-left: 4px solid var(--accent);
  background: var(--tint);
}

.reading blockquote p:last-child {
  margin-bottom: 0;
}

.reading cite {
  display: block;
  margin-top: 16px;
  color: var(--primary);
  font-size: 16px;
  font-weight: 400;
  font-style: italic;
}

.reading ul,
.reading ol {
  margin-block: 24px;
  padding-left: 30px;
  list-style-type: decimal;
}

.reading li {
  padding-left: 6px;
  margin-block: 10px;
}

.reading li::marker {
  color: var(--accent);
  font-weight: 600;
}

.reading li ul,
.reading li ol {
  margin-block: 12px;
}

.reading table {
  width: 100%;
  margin-block: 24px;
  border-collapse: collapse;
  font-size: 18px;
  line-height: 1.5;
}

.reading caption {
  padding-bottom: 12px;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  caption-side: top;
}

.reading th,
.reading td {
  min-width: 130px;
  padding: 14px;
  border: 1px solid var(--primary);
  vertical-align: top;
  text-align: left;
}

.reading th {
  background: var(--primary);
  color: var(--surface);
  font-weight: 600;
}

.reading tbody tr:nth-child(even) td {
  background: var(--tint);
}

.reading tbody tr:nth-child(odd) td {
  background: var(--surface);
}

.reading img {
  max-width: 100%;
  height: auto;
}

.reading a {
  text-decoration-thickness: 1px;
}

.colophon {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
  padding-block: 24px 32px;
  border-top: 3px double var(--primary);
}

.footer-note {
  font-size: 14px;
}

.colophon nav {
  min-width: 0;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0 0 0 12px;
  border-left: 1px solid var(--primary);
  list-style: none;
}

.footer-links li {
  min-width: 0;
}

.footer-links a {
  display: block;
  padding: 10px;
  border: 1px solid var(--primary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.reveal.is-visible {
  animation: enter var(--duration) ease 50ms both;
}

@keyframes enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes menu-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes image-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

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

@media (max-width: 1180px) {
  #stories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .welcome {
    grid-template-columns: minmax(0, 1fr) 100px;
  }

  .welcome-art {
    width: 100px;
    height: 100px;
  }

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

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

@media (max-width: 944px) {
  body {
    gap: 40px;
    font-size: 18px;
  }

  h1 {
    font-size: 36px;
  }

  h2 {
    font-size: 24px;
  }

  .masthead {
    min-height: 64px;
    gap: 16px;
  }

  .home-link {
    max-width: calc(100% - 60px);
  }

  .site-title {
    font-size: 22px;
  }

  .publication {
    display: none;
  }

  .enhanced .nav-button {
    display: inline-flex;
  }

  main.content-frame {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .enhanced .navigation-panel {
    display: none;
  }

  .page-sections {
    gap: 40px;
  }

  #stories {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .slide-copy {
    gap: 20px;
    padding: 20px 0 0;
  }

  .slide-copy h3 {
    font-size: 26px;
  }

  .slide-copy .outline-link {
    width: 100%;
  }

  .story-page {
    gap: 24px;
  }

  .reading h2 {
    margin-top: 40px;
    font-size: 28px;
  }

  .reading h3 {
    font-size: 22px;
  }

  .reading blockquote {
    padding: 20px;
  }

  .colophon {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
}

@media (max-width: 600px) {
  .welcome {
    grid-template-columns: minmax(0, 1fr);
  }

  .welcome-art {
    width: 88px;
    height: 88px;
    justify-self: end;
  }
}

@media (max-width: 480px) {
  .content-frame {
    width: calc(100% - 44px);
  }

  h1 {
    font-size: 32px;
  }

  .home-link {
    gap: 10px;
  }

  .home-link img {
    width: 36px;
    height: 36px;
  }

  .site-title {
    font-size: 18px;
  }

  .jump {
    left: 22px;
  }

  .jump:focus {
    max-width: calc(100% - 44px);
  }

  .menu-dialog {
    padding: 22px;
  }

  .slide-list,
  .footer-links {
    grid-template-columns: minmax(0, 1fr);
  }

  .slide-copy h3 {
    font-size: 24px;
  }

  .story-label {
    padding-inline: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal.is-visible,
  .menu-dialog.is-opening,
  .slide-panel.is-fading-out .slide-visual,
  .slide-panel.is-fading-in .slide-visual {
    animation: none;
  }

  .slide-visual {
    opacity: 1;
  }

  .menu-dialog {
    transform: none;
  }
}
