html {
  box-sizing: border-box;
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

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

body {
  margin: 0;
  background: #3c283d;
  color: #d7d6ea;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

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

a {
  color: inherit;
}

button,
summary {
  font-size: inherit;
  font-weight: 500;
  line-height: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  font-weight: 500;
}

strong,
b {
  font-weight: 600;
}

:focus-visible {
  outline: 2px solid #cd8f13;
  outline-offset: 4px;
}

img,
svg {
  max-width: 100%;
  vertical-align: middle;
}

.edition-head,
.main-content-frame,
.credits-row,
.read-main {
  width: calc(100% - 76px);
  max-width: 1234px;
  margin-inline: auto;
  padding-inline: 0;
}

.read-main {
  display: block;
  padding-block: 8px;
  color: #b5b1e8;
  font-size: 14px;
  line-height: 1.5;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.edition-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #3c283d;
  box-shadow: 0 8px 24px rgba(23, 12, 26, 0.1);
}

.brand-row {
  position: relative;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: center;
  padding-block: 8px;
}

.edition-home {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
}

.edition-home img {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.edition-title {
  min-width: 0;
  color: #d7d6ea;
  font-size: 36px;
  font-weight: 500;
  font-style: italic;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.navigation-row {
  position: absolute;
  top: calc(100% + 36px);
  right: 0;
  width: 262px;
  max-height: calc(100dvh - 148px);
  overflow-y: auto;
}

#edition-nav {
  min-width: 0;
  padding: 4px;
}

.nav-heading {
  margin: 0 0 18px;
  color: #cd8f13;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.edition-links,
.nav-pages {
  margin: 0;
  padding: 0;
  list-style: none;
}

.edition-links a {
  display: block;
  padding-block: 6px;
  text-decoration: none;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

.edition-links a:hover,
.edition-links a[aria-current="page"] {
  text-decoration: underline;
}

.menu-separator {
  display: block;
  width: 30px;
  height: 30px;
  margin-block: 4px;
}

.edition-links summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 6px;
  cursor: pointer;
  list-style: none;
}

.edition-links summary::-webkit-details-marker {
  display: none;
}

.disclosure-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.edition-links details[open] .vertical-stroke {
  display: none;
}

.nav-pages {
  display: grid;
  gap: 8px;
  padding-top: 14px;
}

.nav-pages a {
  color: #b5b1e8;
  font-size: 16px;
  line-height: 1.5;
}

.nav-note {
  margin: 28px 0 0;
  color: #b5b1e8;
  font-size: 16px;
  font-style: italic;
  line-height: 1.6;
}

.nav-switch,
.dialog-close {
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #d7d6ea;
}

.nav-switch {
  display: none;
  width: 36px;
  min-height: 44px;
}

.nav-switch svg,
.dialog-close svg {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

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

.navigation-dialog {
  width: 262px;
  max-width: calc(100% - 24px);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto 0 0;
  padding: 18px;
  border: 0;
  border-radius: 0;
  overflow-y: auto;
  background: #3c283d;
  color: #d7d6ea;
  box-shadow: 12px 0 36px rgba(23, 12, 26, 0.25);
}

.navigation-dialog::backdrop {
  background: rgba(23, 12, 26, 0.65);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
}

.dialog-close {
  display: inline-flex;
  width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}

.main-content-frame {
  min-height: calc(100vh - 210px);
  padding-block: 36px;
  scroll-margin-top: 100px;
}

.page-content {
  width: calc(100% - 290px);
  min-width: 0;
}

.content-inset {
  display: grid;
  width: calc(100% - 16px);
  min-width: 0;
  gap: 36px;
  margin-inline: 8px;
}

.opening {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 128px;
  column-gap: 28px;
  row-gap: 14px;
  align-items: center;
}

.opening p {
  grid-column: 1;
  margin: 0;
  color: #cd8f13;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.opening h1,
.reading-head h1 {
  margin: 0;
  color: #d7d6ea;
  font-size: 62px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.opening h1 {
  grid-column: 1;
}

.opening-art {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 128px;
  height: 160px;
  align-self: end;
}

.posts-section {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.posts-head {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.posts-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.3;
}

.section-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.post-list {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  scroll-margin-top: 100px;
}

.post-slot {
  display: flex;
  min-width: 0;
}

.post-slot:first-child {
  grid-column: 1 / -1;
}

.post {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 332px;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 18px;
  border-radius: 0;
  background: #49334b;
  color: #d7d6ea;
  text-align: left;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(23, 12, 26, 0.14);
  transition: box-shadow 250ms ease;
}

.post-slot:first-child .post {
  min-height: 300px;
  background: #b5b1e8;
  color: #3c283d;
}

.post:hover {
  box-shadow: 0 10px 28px rgba(23, 12, 26, 0.3);
}

.post-meta {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.read-note {
  margin: 0;
}

.post h3 {
  display: -webkit-box;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.abstract {
  display: -webkit-box;
  max-width: 65ch;
  margin: 0 0 6px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
}

.post-action {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 8px 14px;
  border: 1px solid currentColor;
  border-radius: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}

.post-page {
  width: 100%;
  max-width: 698px;
  margin-left: 0;
  margin-right: auto;
}

.reading-head {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.location {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  color: #b5b1e8;
  font-size: 16px;
  line-height: 1.6;
}

.location a {
  flex-shrink: 0;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.location span[aria-current="page"] {
  min-width: 0;
}

.location-separator {
  color: #cd8f13;
}

.reading-head .post-meta {
  color: #b5b1e8;
}

.prose {
  display: flow-root;
  min-width: 0;
  max-width: 100%;
}

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

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

.prose p {
  margin-block: 0 22px;
}

.prose h2 {
  margin: 36px 0 18px;
  color: #b5b1e8;
  font-size: 34px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.prose h3 {
  margin: 28px 0 14px;
  color: #d7d6ea;
  font-size: 26px;
  font-weight: 500;
  line-height: 1.35;
}

.prose a {
  color: #b5b1e8;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.prose blockquote {
  margin: 28px 0;
  padding: 6px 0 6px 22px;
  border-left: 3px solid #cd8f13;
  color: #b5b1e8;
  font-size: 22px;
  font-style: italic;
  line-height: 1.6;
}

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

.prose cite {
  display: block;
  margin-top: 12px;
  color: #d7d6ea;
  font-size: 16px;
  font-weight: 400;
  font-style: normal;
}

.prose ul,
.prose ol {
  margin: 0 0 22px;
  padding-left: 1.4em;
}

.prose ul {
  list-style-type: disc;
}

.prose ol {
  list-style-type: decimal;
}

.prose li {
  padding-left: 4px;
}

.prose li + li {
  margin-top: 8px;
}

.prose li::marker {
  color: #cd8f13;
  font-weight: 500;
}

.prose table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.6;
}

.prose caption {
  padding-bottom: 12px;
  color: #b5b1e8;
  font-size: 16px;
  text-align: left;
}

.prose th,
.prose td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: #57425c;
  color: #d7d6ea;
  font-weight: 600;
}

.prose tbody tr:nth-child(odd) {
  background: rgba(181, 177, 232, 0.06);
}

.prose tbody tr:nth-child(even) {
  background: rgba(181, 177, 232, 0.13);
}

.prose img {
  height: auto;
}

.prose pre {
  max-width: 100%;
  padding: 18px;
  overflow-x: auto;
  background: #49334b;
  font-size: 16px;
}

.edition-foot {
  padding-block: 24px;
  background: #352336;
}

.credits-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 28px;
  color: #b5b1e8;
  font-size: 14px;
  line-height: 1.6;
}

.credits-row p {
  margin: 0;
}

.reveal-item.is-waiting {
  opacity: 0;
  transform: translateX(8px);
}

.reveal-item.is-waiting:focus-within {
  opacity: 1;
  transform: translateX(0);
}

.reveal-item.is-revealing {
  animation: reveal-items 250ms ease-out 0ms both;
}

@keyframes reveal-items {
  from {
    opacity: 0;
    transform: translateX(8px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

  .opening-art {
    display: none;
  }
}

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

  .post {
    min-height: 300px;
  }
}

@media (max-width: 682px) {
  body {
    font-size: 16px;
  }

  .brand-row {
    display: grid;
    min-height: 64px;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 4px;
  }

  .edition-home {
    grid-column: 2;
    grid-row: 1;
    gap: 8px;
  }

  .edition-home img {
    width: 30px;
    height: 30px;
  }

  .edition-title {
    font-size: 24px;
  }

  .nav-switch {
    display: inline-flex;
    grid-column: 1;
    grid-row: 1;
  }

  .navigation-row {
    display: none;
  }

  .page-content {
    width: 100%;
  }

  .opening h1,
  .reading-head h1 {
    font-size: 36px;
    line-height: 1.15;
  }

  .opening p {
    font-size: 12px;
  }

  .posts-head h2 {
    font-size: 24px;
  }

  .post,
  .post-slot:first-child .post {
    min-height: 280px;
  }

  .post h3 {
    font-size: 24px;
  }

  .prose h2 {
    font-size: 28px;
  }

  .prose h3 {
    font-size: 23px;
  }

  .prose blockquote {
    padding-left: 18px;
    font-size: 20px;
  }

  .credits-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .edition-head,
  .main-content-frame,
  .credits-row,
  .read-main {
    width: calc(100% - 48px);
  }
}

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

  .post {
    transition: none;
  }

  .reveal-item.is-waiting,
  .reveal-item.is-revealing {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
