html {
  box-sizing: border-box;
}

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

:root {
  --ground: #104a1a;
  --text: #c1d3ab;
  --primary: #b6d88d;
  --accent: #51e6b5;
  --surface: #184f25;
  --shade: #0b3818;
  --deep: #092e16;
  --line: #75986c;
  --radius: 14px;
  --soft-shadow: 0 8px 20px rgba(4, 28, 12, .22);
  --hover-shadow: 0 10px 24px rgba(4, 28, 12, .4);
  --duration: 600ms;
  --reveal-step: 100ms;
}

body {
  margin: 0;
  background-color: var(--ground);
  color: var(--text);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

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

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

h1 {
  font-size: 60px;
  font-weight: 700;
  line-height: 1.06;
}

h2 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
}

a {
  color: var(--accent);
  text-underline-offset: .18em;
}

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

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

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

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

.edition-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--ground);
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-height: 82px;
  padding-block: 8px;
  border-block-end: 1px dotted var(--line);
}

.read-main {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.edition-title {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 46px;
  min-height: 44px;
  padding-inline: 6px;
  border: 1px solid var(--primary);
  border-radius: 10px;
  background: var(--primary);
  color: var(--deep);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.05em;
  text-decoration: none;
}

.edition-caption {
  color: var(--primary);
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.edition-note {
  margin-inline-start: auto;
  color: var(--text);
  font-size: 14px;
  font-style: italic;
}

.navigation-row {
  position: absolute;
  inset-block-start: calc(100% + 44px);
  inset-inline-start: 0;
  width: 188px;
  max-height: calc(100dvh - 142px);
  padding: 5px;
  overflow: auto;
}

.nav-list, .nav-entries, .feature-choices, .post-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.nav-list {
  display: grid;
  gap: 10px;
  padding-inline-start: 10px;
  border-inline-start: 1px solid var(--line);
}

.nav-entries {
  display: grid;
  gap: 8px;
  margin-block-start: 8px;
  padding-inline-start: 10px;
  border-inline-start: 1px solid var(--line);
}

.nav-link, .nav-group > summary, .nav-switch, .nav-close, .feature-choice {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  transition: box-shadow var(--duration) ease;
}

.nav-link:hover, .nav-group > summary:hover, .nav-switch:hover, .nav-close:hover, .feature-choice:hover {
  box-shadow: var(--hover-shadow);
}

.nav-link, .nav-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 44px;
  padding: 6px 9px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
}

.nav-entries .nav-link {
  font-weight: 400;
}

.nav-link[aria-current='page'], .feature-choice[aria-pressed='true'] {
  padding-inline-start: 6px;
  border-inline-start: 4px solid var(--accent);
  background: var(--shade);
  color: var(--primary);
}

.nav-group > summary {
  list-style: none;
  cursor: pointer;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-group[open] .nav-caret {
  transform: rotate(180deg);
}

.edition-mark {
  display: block;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.nav-switch, .nav-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 5px;
}

.nav-switch {
  margin-inline-start: auto;
}

.nav-dialog {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: min(90vw, 350px);
  max-width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-inline-end: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--ground);
  color: var(--text);
  box-shadow: var(--soft-shadow);
}

.nav-dialog::backdrop {
  background: rgba(4, 24, 11, .74);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block-end: 18px;
  padding-block-end: 12px;
  border-block-end: 1px dotted var(--line);
}

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

.main-content-frame {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  column-gap: 36px;
  padding-block: 44px;
  scroll-margin-block-start: 88px;
}

.page-edition, .story-layout {
  grid-column: 2;
  min-width: 0;
}

.page-edition {
  display: grid;
  gap: 44px;
}

.opening {
  padding-inline: 16px;
}

.feature-row {
  position: relative;
  min-width: 0;
}

.feature, .post, .rubric-row, .post-page, .story-aside {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.feature, .post-page {
  border-block-start: 2px solid var(--accent);
}

.feature {
  width: 75%;
}

.feature-content {
  display: grid;
  gap: 18px;
}

.feature-head, .section-cap, .aside-cap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feature-head {
  padding-block-end: 10px;
  border-block-end: 1px dotted var(--line);
}

.feature-grid, .feature-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.feature.is-ready .feature-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, .52fr);
  grid-template-areas: 'panels choices';
  align-items: start;
}

.feature.is-ready .feature-panels {
  grid-area: panels;
}

.feature.is-ready .feature-choices {
  grid-area: choices;
}

.feature-choices {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.feature-choice {
  width: 100%;
  min-height: 44px;
  padding: 9px;
  font-weight: 600;
  text-align: start;
  overflow-wrap: anywhere;
}

.feature-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  isolation: isolate;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--deep);
}

.feature-image {
  display: block;
  grid-area: 1 / 1;
  align-self: start;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  object-fit: cover;
  filter: grayscale(1);
  opacity: .7;
}

.feature-title {
  z-index: 1;
  grid-area: 1 / 1;
  align-self: end;
  padding: 14px;
  border-block-start: 1px solid var(--line);
  border-radius: 0 0 9px 9px;
  background: var(--deep);
  font-size: clamp(22px, 2.5vw, 32px);
  font-weight: 600;
  line-height: 1.16;
}

.feature-title a {
  color: var(--primary);
}

.position-bar {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: var(--deep);
  color: var(--accent);
  accent-color: var(--accent);
}

.position-bar::-webkit-progress-bar {
  background: var(--deep);
}

.position-bar::-webkit-progress-value {
  border-radius: 8px;
  background: var(--accent);
}

.position-bar::-moz-progress-bar {
  border-radius: 8px;
  background: var(--accent);
}

.field-drawing {
  position: absolute;
  inset-block-start: 22px;
  inset-inline-end: 0;
  width: 21%;
  height: auto;
  aspect-ratio: 1 / 1;
  color: var(--primary);
  opacity: .65;
  pointer-events: none;
}

.posts-section, .rubrics-section {
  display: grid;
  gap: 18px;
  min-width: 0;
  scroll-margin-block-start: 94px;
}

.section-cap {
  padding: 0 16px 12px;
  border-block-end: 1px dotted var(--line);
}

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

.post {
  border-inline-start: 2px solid var(--primary);
  text-align: start;
  transition: box-shadow var(--duration) ease;
}

.post:nth-child(even) {
  margin-block-start: 28px;
  border-inline-start-color: var(--accent);
  background: var(--shade);
}

.post:hover, .post:focus-within {
  box-shadow: var(--hover-shadow);
}

.post-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  font-size: .875em;
  line-height: 1.45;
}

.post-label {
  display: inline-block;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--primary);
  font-weight: 600;
}

.read-note {
  font-style: italic;
}

.post h3 {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.22;
}

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

.post h3 a {
  color: var(--primary);
  -webkit-line-clamp: 2;
}

.abstract {
  -webkit-line-clamp: 3;
}

.rubric-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  border-inline-start: 2px solid var(--accent);
}

.story-layout {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr);
  grid-template-areas: 'aside text';
  align-items: start;
  gap: 18px;
}

.post-page {
  grid-area: text;
  width: 100%;
  max-width: 608px;
  margin-left: auto;
  margin-right: auto;
}

.story-head {
  display: grid;
  gap: 16px;
  padding-block-end: 18px;
  border-block-end: 1px dotted var(--line);
}

.story-aside {
  grid-area: aside;
  width: 100%;
  max-width: 608px;
  margin-inline: auto;
  border-inline-start: 2px solid var(--primary);
}

.aside-cap {
  padding-block-end: 10px;
  border-block-end: 1px dotted var(--line);
}

.story-aside p {
  margin-block-start: 12px;
}

.aside-drawing {
  display: block;
  width: min(100%, 152px);
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 18px auto 0;
  color: var(--primary);
  opacity: .65;
}

.prose {
  min-width: 0;
  padding-block-start: 18px;
}

.prose p, .prose ul, .prose ol, .prose blockquote {
  margin: 0 0 16px;
}

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

.prose h2 {
  margin: 28px 0 10px;
  font-size: 34px;
}

.prose h3 {
  margin: 22px 0 8px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
}

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

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

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

.prose li + li {
  margin-block-start: 4px;
}

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

.prose blockquote {
  padding: 18px;
  border-inline-start: 2px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--shade);
  font-style: italic;
}

.prose blockquote::before {
  display: block;
  margin-block-end: 18px;
  color: var(--accent);
  content: '«';
  font-size: 50px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}

.prose blockquote > :last-child {
  margin-block-end: 0;
}

.prose cite {
  color: var(--primary);
  font-style: italic;
  font-weight: 500;
}

.prose table {
  width: 100%;
  margin-block: 10px 16px;
  border-collapse: collapse;
}

.prose th, .prose td {
  padding: 8px 10px;
  border-block-end: 1px dotted var(--line);
  text-align: start;
  vertical-align: top;
}

.prose th {
  color: var(--primary);
  font-weight: 700;
}

.prose caption {
  padding-block-end: 8px;
  caption-side: top;
  color: var(--primary);
  font-weight: 600;
  text-align: start;
}

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

.credits-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  padding-block: 16px 22px;
  border-block-start: 1px dotted var(--line);
  font-size: 14px;
}

.credits-note {
  font-style: italic;
}

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

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

.reveal {
  animation: reveal-items var(--duration) ease-out var(--reveal-step) backwards;
}

.feature-content, .story-aside .reveal {
  animation-delay: calc(2 * var(--reveal-step));
}

.section-cap .reveal, .prose.reveal {
  animation-delay: calc(3 * var(--reveal-step));
}

.post-copy {
  animation-delay: calc(4 * var(--reveal-step));
}

.post:nth-child(2) .post-copy {
  animation-delay: calc(5 * var(--reveal-step));
}

.post:nth-child(3) .post-copy {
  animation-delay: calc(6 * var(--reveal-step));
}

@keyframes fade-slide {
  from {
    opacity: .25;
  }
  to {
    opacity: 1;
  }
}

.feature-panel.is-entering {
  animation: fade-slide var(--duration) ease-out;
}

.navigation-row[hidden], .nav-switch[hidden], .feature-choices[hidden], .feature-panel[hidden], .position-bar[hidden] {
  display: none;
}

@media (max-width: 1080px) {
  .story-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'text' 'aside';
  }
}

@media (max-width: 980px) {
  .feature {
    width: 100%;
  }

  .field-drawing {
    display: none;
  }
}

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

  .post:nth-child(even) {
    margin-block-start: 0;
  }
}

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

  h1 {
    font-size: clamp(28px, 8vw, 40px);
  }

  .brand-row {
    min-height: 64px;
    gap: 8px 12px;
  }

  .edition-caption, .edition-note {
    display: none;
  }

  .navigation-row {
    position: static;
    width: 100%;
    max-height: 35vh;
    padding-block: 10px;
  }

  .main-content-frame {
    grid-template-columns: minmax(0, 1fr);
    padding-block: 28px 36px;
    scroll-margin-block-start: 72px;
  }

  .page-edition, .story-layout {
    grid-column: 1;
  }

  .page-edition {
    gap: 36px;
  }

  .feature.is-ready .feature-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'choices' 'panels';
  }

  .feature-choices {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 116px), 1fr));
  }

  .feature-choice {
    height: 100%;
  }

  .post-list {
    gap: 20px;
  }

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

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

@media (prefers-reduced-motion: reduce) {
  .reveal, .feature-panel.is-entering {
    animation: none;
  }

  .nav-link, .nav-group > summary, .nav-switch, .nav-close, .feature-choice, .post {
    transition: none;
  }
}
