:root {
  color-scheme: dark;
  --paper: #30221b;
  --panel: #3d2b24;
  --panel-light: #49332a;
  --ink: #e4ccd0;
  --rose: #e2adb5;
  --accent: #b4e87f;
  --muted: #cdb3b7;
  --rule: #886960;
  --shadow: 0 8px 24px rgb(22 12 8 / 24%);
}

html {
  box-sizing: border-box;
}

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

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

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  gap: 40px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

h1, h2, h3, p, figure {
  margin: 0;
}

h1, h2, h3 {
  line-height: 1.15;
  font-weight: 700;
}

h1 {
  color: var(--rose);
  font-size: 34px;
}

a {
  color: var(--rose);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent);
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.edition-head, .main-content-frame, .edition-foot {
  width: calc(100% - 40px);
  max-width: 1032px;
  margin-inline: auto;
  padding-inline: 0;
}

.edition-head {
  position: static;
  display: grid;
  min-height: 72px;
  align-content: center;
  border-bottom: 3px double var(--rule);
}

.brand-row, .naming {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-row {
  min-height: 34px;
  justify-content: space-between;
}

.edition-title {
  display: inline-grid;
  min-width: 38px;
  min-height: 30px;
  place-items: center;
  padding-inline: 4px;
  border-radius: 4px;
  background: var(--rose);
  color: var(--paper);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.06em;
  text-decoration: none;
}

.edition-title:hover {
  background: var(--accent);
  color: var(--paper);
}

.edition-name {
  color: var(--rose);
  font-size: 18px;
  font-weight: 700;
}

.edition-type, .credits-title {
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.navigation-row {
  display: flex;
  min-height: 35px;
  min-width: 0;
  align-items: center;
}

.tabs, .foot-list, .story-list, .post-list, .location ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tabs, .foot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.tab-link, .foot-list a, .story-list a {
  display: block;
  padding: 2px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

.tab-link:hover, .foot-list a:hover, .story-list a:hover {
  background: var(--panel-light);
}

.tab-link[aria-current="page"], .foot-list a[aria-current="page"], .story-list a[aria-current="page"] {
  border-color: var(--accent);
  color: var(--accent);
}

.read-main {
  position: absolute;
  z-index: 2;
  inset-block-start: 8px;
  inset-inline-start: 24px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.read-main:focus {
  width: auto;
  height: auto;
  padding: 6px 12px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--paper);
  clip-path: none;
}

.mark {
  display: block;
  width: 30px;
  height: 30px;
  flex: none;
}

.nav-switch, .nav-close {
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border: 0;
  border-radius: 4px;
  background: var(--rose);
  color: var(--paper);
  font-size: 16px;
  font-weight: 700;
}

.nav-switch {
  display: none;
}

.nav-close {
  display: inline-flex;
}

.nav-switch:hover, .nav-close:hover {
  background: var(--accent);
}

.nav-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 24px;
  overflow: auto;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}

.dialog-body {
  display: grid;
  max-width: 500px;
  gap: 24px;
  margin-inline: auto;
}

.dialog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 3px double var(--rule);
}

.dialog-head h2 {
  color: var(--rose);
  font-size: 26px;
}

.dialog-links .tabs {
  display: grid;
  gap: 8px;
}

.dialog-links .tab-link {
  min-height: 44px;
  padding: 8px 12px;
  background: var(--panel);
  font-size: 18px;
}

.dialog-links .tab-link:hover {
  background: var(--panel-light);
}

.main-content-frame {
  flex: 1;
}

.front {
  display: grid;
  align-content: start;
  gap: 40px;
}

.opening {
  display: grid;
  min-height: 222px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 26px 30px;
  border-radius: 6px;
  background: radial-gradient(ellipse at 80% 40%, #563c31, transparent 70%), var(--panel);
  box-shadow: var(--shadow);
}

.opening-copy {
  display: grid;
  gap: 10px;
}

.opening-copy p {
  max-width: 32ch;
  color: var(--ink);
}

.opening-art {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  justify-self: center;
  color: var(--accent);
  pointer-events: none;
}

.posts-section {
  display: grid;
  gap: 16px;
  padding-top: 12px;
  border-top: 3px double var(--rule);
}

.posts-head, .side-head {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: var(--rose);
}

.posts-head .mark, .side-head .mark {
  color: var(--accent);
}

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

.post-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.post-list > li {
  min-width: 0;
}

.post-list > li:first-child {
  grid-column: 1 / -1;
}

.post {
  display: grid;
  height: 100%;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr);
  align-items: center;
  gap: 16px;
  padding: 22px;
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--rose);
  text-decoration: none;
}

.post-list > li:first-child .post {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  background: var(--panel-light);
}

.post:hover, .post-list > li:first-child .post:hover {
  background: #52392e;
  color: var(--accent);
}

.post-copy {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.post h3, .abstract {
  display: -webkit-box;
  width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.post h3 {
  font-size: 26px;
  font-weight: 700;
  -webkit-line-clamp: 1;
}

.abstract {
  color: var(--ink);
  -webkit-line-clamp: 2;
}

.post-meta, .read-note {
  display: flex;
  align-items: center;
}

.post-meta {
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.4;
}

.post-label {
  padding: 2px 7px;
  border-radius: 4px;
  background: #5a3d34;
  color: var(--ink);
  font-weight: 600;
}

.read-note {
  gap: 5px;
}

.read-note .mark {
  color: var(--rose);
}

.post-call {
  display: inline-block;
  justify-self: center;
  padding: 5px 13px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--paper);
  font-size: 16px;
  font-weight: 700;
}

.post:hover .post-call {
  background: var(--rose);
}

.post-preview, .side-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  background: #5a4135;
}

.post-preview img, .side-preview img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  filter: sepia(0.22) saturate(0.8);
}

.story-frame {
  display: grid;
  grid-template-columns: 284px minmax(0, 624px);
  align-content: start;
  align-items: start;
  justify-content: center;
  gap: 30px;
}

.post-page {
  display: grid;
  width: 100%;
  max-width: 624px;
  grid-column: 2;
  grid-row: 1;
  gap: 24px;
  margin-left: auto;
  margin-right: auto;
  padding: 26px;
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.story-head {
  display: grid;
  gap: 12px;
}

.story-head .post-meta {
  justify-content: flex-start;
}

.location {
  color: var(--muted);
  font-size: 16px;
}

.location ol {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
}

.location-divider {
  margin-inline-end: 8px;
  color: var(--accent);
}

.story-side {
  display: grid;
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
  gap: 16px;
}

.side-panel {
  display: grid;
  grid-template-columns: minmax(0, 156px) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.side-preview {
  width: 156px;
  max-width: 100%;
}

.side-caption {
  color: var(--muted);
  font-size: 16px;
  font-style: italic;
}

.post-links {
  display: grid;
  gap: 8px;
  padding: 12px 0 0;
  border-top: 3px double var(--rule);
}

.side-head h2 {
  font-size: 22px;
}

.story-list {
  display: grid;
  gap: 4px;
}

.story-list a {
  background: var(--panel);
}

.reading {
  min-width: 0;
  padding-top: 20px;
  border-top: 3px double var(--rule);
}

.reading p, .reading h2, .reading h3, .reading ul, .reading ol, .reading blockquote, .reading table {
  margin-block: 0 0.85em;
}

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

.reading h2, .reading h3 {
  margin-top: 1.15em;
  color: var(--rose);
}

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

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

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

.reading ul, .reading ol {
  padding-inline-start: 1.4em;
}

.reading ul {
  list-style: square;
}

.reading li + li {
  margin-top: 4px;
}

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

.reading blockquote {
  margin-inline: 0;
  padding: 14px 16px;
  border: 1px solid var(--rose);
  border-radius: 4px;
  background: var(--panel-light);
  font-style: italic;
}

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

.reading cite {
  color: var(--rose);
  font-style: italic;
  font-weight: 600;
}

.reading table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.reading caption {
  padding-bottom: 8px;
  color: var(--rose);
  font-weight: 700;
  text-align: left;
}

.reading th, .reading td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.reading th {
  color: var(--rose);
  font-weight: 700;
}

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

.edition-foot {
  padding-block: 14px 20px;
  border-top: 3px double var(--rule);
}

.credits-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.reveal {
  width: calc(100% - 16px);
  margin-inline: auto;
  animation: reveal-items 150ms ease-out 100ms both;
}

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

.nav-dialog.menu-motion[open] .dialog-body {
  animation: menu-fade 150ms ease-out both;
}

@keyframes menu-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.post, .post-call, .tab-link, .edition-title, .nav-switch, .nav-close, .foot-list a, .story-list a, .location a, .reading a {
  transition: color 150ms ease, background-color 150ms ease;
}

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

  .edition-head.menu-ready {
    min-height: 68px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .edition-type {
    display: none;
  }

  .menu-ready .nav-switch {
    display: inline-flex;
  }

  .menu-ready .navigation-row > #edition-nav {
    display: none;
  }

  .opening, .post-list, .post, .post-list > li:first-child .post, .story-frame {
    grid-template-columns: minmax(0, 1fr);
  }

  .opening {
    gap: 16px;
    padding: 22px;
  }

  .opening-copy p {
    max-width: 43ch;
  }

  .post-list > li:first-child {
    grid-column: auto;
  }

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

  .post-preview {
    max-width: 640px;
    justify-self: center;
    order: -1;
  }

  .story-frame {
    gap: 40px;
  }

  .post-page, .story-side {
    grid-column: auto;
    grid-row: auto;
  }

  .post-page {
    padding: 20px;
  }

  .story-side {
    width: 100%;
    max-width: 624px;
    justify-self: center;
  }

  .side-panel {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }
}

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

  h1 {
    font-size: 30px;
  }

  .opening, .post-page {
    padding: 18px;
  }

  .post-page {
    gap: 20px;
  }

  .foot-list {
    gap: 4px;
  }

  .foot-list a {
    padding-inline: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .nav-dialog.menu-motion[open] .dialog-body {
    animation: none;
  }

  .post, .post-call, .tab-link, .edition-title, .nav-switch, .nav-close, .foot-list a, .story-list a, .location a, .reading a {
    transition: none;
  }
}

.article-cover { display:block; width:100%; height:auto; aspect-ratio:3/2; object-fit:cover; border-radius:4px; margin:0 0 22px; }
.post-preview { aspect-ratio:3/2; }
.post h3 { -webkit-line-clamp:unset; overflow:visible; }
.abstract { -webkit-line-clamp:unset; }
.table-scroll { max-width:100%; overflow-x:auto; margin-bottom:20px; }
