html {
  box-sizing: border-box;
}

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

:root {
  --page: #05170c;
  --text: #7caf79;
  --primary: #41f436;
  --accent: #a88319;
  --surface: rgba(65, 244, 54, 0.035);
}

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

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

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

h1,
h2,
h3 {
  font-weight: 600;
}

strong,
b {
  font-weight: 700;
}

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

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

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

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

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

.top-band {
  position: static;
  width: 100%;
  background: var(--surface);
}

.top-band > .band-content {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 8px;
}

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

.to-main:focus {
  top: 8px;
  left: 20px;
  z-index: 20;
  width: auto;
  height: auto;
  padding: 12px 16px;
  overflow: visible;
  clip-path: inset(0);
  white-space: normal;
  background: var(--primary);
  color: var(--page);
}

.site-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
}

.site-link img {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.site-name {
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.nav-slot {
  min-width: 0;
  margin-left: auto;
}

.nav-list,
.footer-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list li,
.footer-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.nav-dot {
  color: var(--accent);
}

.site-nav a,
.footer-list a,
.nav-trigger,
.nav-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--primary);
  border-radius: 0;
  background: var(--primary);
  color: var(--page);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: box-shadow 400ms ease;
}

.site-nav a[aria-current='page'],
.footer-list a[aria-current='page'],
.entry-links a[aria-current='page'] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.nav-trigger {
  display: none;
  flex-shrink: 0;
  margin-left: auto;
}

.button-mark,
.section-mark,
.link-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
}

.menu-dialog {
  width: 100%;
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100%;
  margin: 0;
  padding: 24px 20px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: var(--page);
  color: var(--text);
}

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

.menu-dialog[open].menu-animated {
  animation: menu-fade 400ms ease;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.dialog-content {
  margin-top: 30px;
}

.main-frame {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 30px;
  min-width: 0;
  margin-block: 30px;
}

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  column-gap: 38px;
  row-gap: 16px;
  align-items: center;
}

.welcome h1,
.entry-heading h1 {
  color: var(--primary);
  font-size: 62px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.welcome h1,
.welcome p {
  grid-column: 1;
}

.welcome p {
  max-width: 732px;
}

.welcome-sign {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 132px;
  height: 132px;
}

.materials {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.section-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.section-top h2 {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text);
  font-size: 32px;
  line-height: 1.2;
}

.section-mark {
  color: var(--accent);
}

.section-note {
  color: var(--accent);
  font-size: 16px;
}

.entry-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

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

.entry {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  height: 100%;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  text-align: right;
  text-decoration: none;
  transition: box-shadow 400ms ease;
}

.entry-featured {
  grid-template-columns: minmax(132px, 1fr) minmax(0, 2fr);
  align-items: center;
}

.entry-reversed {
  grid-template-columns: minmax(0, 1fr) 132px;
}

.entry-preview {
  width: 132px;
  aspect-ratio: 4 / 3;
  min-width: 0;
  background: rgba(65, 244, 54, 0.08);
}

.entry-featured .entry-preview {
  width: 100%;
}

.entry-preview img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.entry-reversed .entry-preview {
  grid-column: 2;
  grid-row: 1;
}

.entry-reversed .entry-text {
  grid-column: 1;
  grid-row: 1;
}

.entry-text {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.entry-meta {
  color: var(--text);
  font-size: 16px;
}

.read-length {
  margin: 0;
}

.entry h3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--primary);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

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

.reading-layout {
  display: grid;
  grid-template-columns: 204px minmax(0, 732px);
  justify-content: end;
  align-items: start;
  gap: 38px;
  min-width: 0;
}

.entry-page {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  gap: 30px;
  width: 100%;
  max-width: 732px;
  min-width: 0;
  margin-left: auto;
  margin-right: 0;
}

.entry-heading {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.path-links {
  font-size: 16px;
}

.path-links ol {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.path-separator {
  flex-shrink: 0;
  color: var(--accent);
}

.reading {
  display: grid;
  gap: 24px;
  min-width: 0;
  max-width: 100%;
  padding: 24px;
  border: 1px solid var(--accent);
  background: var(--surface);
  overflow-wrap: anywhere;
}

.reading > * {
  min-width: 0;
  margin-block: 0;
}

.reading p {
  line-height: 1.4;
}

.reading h2 {
  color: var(--primary);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
}

.reading h3 {
  color: var(--primary);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
}

.reading blockquote {
  margin-inline: 0;
  padding: 24px;
  border: 1px solid var(--accent);
  font-style: italic;
}

.reading blockquote p + p {
  margin-top: 16px;
}

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

.reading ul,
.reading ol {
  padding-left: 26px;
}

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

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

.reading li + li,
.reading li > ul,
.reading li > ol {
  margin-top: 16px;
}

.reading table {
  width: 100%;
  border-collapse: collapse;
  font-size: 18px;
  line-height: 1.4;
}

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

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

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

.reading thead {
  background: rgba(65, 244, 54, 0.09);
}

.reading tbody tr:nth-child(odd) {
  background: rgba(65, 244, 54, 0.05);
}

.side-panel {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  gap: 16px;
  width: 204px;
  max-width: 100%;
  min-width: 0;
}

.side-panel h2 {
  display: flex;
  align-items: start;
  gap: 16px;
  color: var(--primary);
  font-size: 26px;
  line-height: 1.2;
}

.side-panel > p {
  font-size: 18px;
}

.entry-links ul {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry-links a {
  display: flex;
  align-items: start;
  gap: 16px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--accent);
  font-size: 18px;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: box-shadow 400ms ease;
}

.entry-links a span {
  min-width: 0;
}

.link-mark {
  color: var(--accent);
}

.bottom-band {
  width: 100%;
  background: var(--surface);
}

.bottom-band > .band-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 24px;
}

.footer-note {
  max-width: 100%;
  color: var(--text);
  font-size: 20px;
  font-weight: 500;
}

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

@media (hover: hover) {
  .entry:hover,
  .entry-links a:hover {
    box-shadow: 0 0 0 2px var(--primary);
  }

  .site-nav a:hover,
  .footer-list a:hover,
  .nav-trigger:hover,
  .nav-close:hover {
    box-shadow: 0 0 0 3px var(--accent);
  }
}

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

  .reading-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
  }

  .entry-page {
    grid-column: 1;
    grid-row: 1;
  }

  .side-panel {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    max-width: 732px;
    margin-left: auto;
  }
}

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

  .top-band > .band-content {
    flex-wrap: wrap;
  }

  .nav-slot {
    flex-basis: 100%;
    order: 3;
  }

  .menu-ready .nav-slot {
    display: none;
  }

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

  .site-nav .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .site-nav .nav-dot {
    display: none;
  }

  .site-nav a {
    width: 100%;
    justify-content: flex-start;
    padding: 16px;
    font-size: 20px;
  }

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

  .welcome h1,
  .entry-heading h1 {
    font-size: clamp(28px, 7vw, 40px);
  }

  .welcome-sign {
    display: none;
  }

  .section-top h2 {
    font-size: 26px;
  }

  .entry,
  .entry-featured,
  .entry-reversed {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 24px;
  }

  .entry .entry-preview {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
  }

  .entry .entry-text {
    grid-column: 1;
    grid-row: 2;
  }

  .entry h3 {
    font-size: 26px;
  }

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

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

  .reading blockquote {
    padding: 16px;
  }

  .bottom-band > .band-content {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .main-frame,
  .band-content {
    width: calc(100% - 36px);
  }

  .to-main:focus {
    left: 18px;
  }

  .menu-dialog {
    padding-inline: 18px;
  }

  .nav-trigger {
    min-width: 44px;
    padding: 8px;
  }

  .nav-trigger .button-label {
    display: none;
  }

  .reading {
    padding: 16px;
  }
}

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

  .entry,
  .entry-links a,
  .site-nav a,
  .footer-list a,
  .nav-trigger,
  .nav-close {
    transition: none;
  }
}
