:root {
  --paper: #f3eee3;
  --paper-light: #faf7f0;
  --ink: #201e1a;
  --muted: #716b62;
  --line: #cfc6b7;
  --accent: #35465c;
  --accent-dark: #2b3a4c;
  --serif: "Noto Serif SC", "Songti SC", STSong, SimSun, serif;
  --sans: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --page: min(85rem, calc(100vw - 4.5rem));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 20rem;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.svg-symbols {
  position: absolute;
  overflow: hidden;
}

.site-header,
main,
.site-footer {
  width: var(--page);
  margin-right: auto;
  margin-left: auto;
}

.site-header {
  min-height: 4rem;
  margin-top: .875rem;
  border-top: 1px solid var(--ink);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.75rem;
  font-size: .6875rem;
  letter-spacing: .12em;
}

.site-brand {
  font-weight: 800;
}

.site-navigation {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-size: .6875rem;
}

.site-navigation a {
  padding: .6rem 0;
  border-bottom: 1px solid transparent;
  font-weight: 700;
}

.site-navigation a:hover,
.site-navigation a[aria-current="page"] {
  color: var(--accent);
  border-color: var(--accent);
}

.site-header::after {
  content: "SITE GUIDE\A EST. 2024";
  justify-self: end;
  color: var(--muted);
  font-size: .5625rem;
  line-height: 1.45;
  text-align: right;
  white-space: pre;
}

main {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  align-items: start;
  column-gap: 2.5rem;
}

.page-intro {
  min-height: 26rem;
  padding: 3.75rem 0 3rem;
  border-bottom: 1px solid var(--ink);
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: 3rem;
}

.section-label {
  margin: 0 0 1.1rem;
  color: var(--accent);
  font-size: .625rem;
  font-weight: 800;
  letter-spacing: .22em;
}

.page-intro h1 {
  margin: 0;
  font: 600 clamp(4.5rem, 9vw, 8rem)/.92 var(--serif);
  letter-spacing: -.08em;
}

.page-description {
  max-width: 42rem;
  margin: 2rem 0 0;
  font: 400 clamp(1.05rem, 1.5vw, 1.25rem)/1.8 var(--serif);
}


.chapter-index {
  position: sticky;
  top: 0;
  max-height: 100vh;
  padding: 2rem 1.5rem 2rem 0;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
}

.chapter-index h2 {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .5625rem;
  font-weight: 800;
  letter-spacing: .2em;
}

.chapter-index ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapter-index a {
  padding: .58rem .25rem;
  display: grid;
  grid-template-columns: 1.8rem minmax(0, 1fr);
  gap: .35rem;
  color: var(--muted);
  font: 400 .78rem/1.45 var(--serif);
}

.chapter-index a span {
  font: 400 .65rem/1.75 Georgia, "Times New Roman", serif;
}

.chapter-index a:hover,
.chapter-index a:focus-visible {
  color: var(--accent);
}

.chapter-index > p {
  margin: 1.5rem .25rem 0;
  color: var(--muted);
  font-size: .625rem;
  line-height: 1.7;
}

.guide-content {
  min-width: 0;
}

.guide-section {
  margin: 0;
  border: 0;
  border-top: 3px solid var(--ink);
  scroll-margin-top: 1rem;
}

.guide-section:first-child {
  border-top: 0;
}

.section-heading {
  width: 100%;
  min-height: 8rem;
  padding: 2.35rem 0 1.8rem;
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr) auto 1.25rem;
  align-items: start;
  gap: 1rem;
  color: var(--ink);
}

summary.section-heading {
  cursor: pointer;
  list-style: none;
  transition: color .16s ease;
}

summary.section-heading::-webkit-details-marker {
  display: none;
}

summary.section-heading:hover {
  color: var(--accent);
}

.guide-section--static .section-heading {
  grid-template-columns: 3.75rem minmax(0, 1fr);
}

.section-number {
  color: var(--accent);
  font: 400 clamp(1.9rem, 3vw, 3rem)/1 Georgia, "Times New Roman", serif;
}

.section-heading h2 {
  margin: 0;
  font: 600 clamp(1.8rem, 3vw, 3rem)/1.05 var(--serif);
  letter-spacing: -.045em;
}

.section-state {
  margin-top: .45rem;
  color: var(--muted);
  font: 700 .6rem var(--sans);
  letter-spacing: .12em;
  white-space: nowrap;
}

.chevron {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: .25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.5;
  transition: transform .2s ease;
}

details[open] .chevron {
  transform: rotate(180deg);
}

.state-open {
  display: none;
}

details[open] .state-open {
  display: inline;
}

details[open] .state-closed {
  display: none;
}

.section-body {
  padding: 0 0 3.5rem 4.75rem;
  border-top: 1px solid var(--line);
  font: 400 .96rem/1.95 var(--serif);
}

.section-body > * {
  max-width: 53rem;
}

.section-body p,
.section-body ul,
.section-body ol,
.section-body blockquote {
  margin-top: 1.35rem;
  margin-bottom: 0;
}

.section-body ul,
.section-body ol {
  padding-left: 1.45rem;
}

.section-body li {
  margin: .55rem 0;
  padding-left: .25rem;
}

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

.section-body li > ul,
.section-body li > ol {
  margin-top: .55rem;
}

.section-body strong {
  font-weight: 700;
}

.section-body a {
  color: var(--accent);
  border-bottom: 1px solid currentColor;
}

.section-body a:hover {
  color: var(--ink);
}

.external-icon {
  width: .78rem;
  height: .78rem;
  margin-left: .2rem;
  display: inline-block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.25;
  vertical-align: -.05em;
}

.section-body blockquote {
  padding: .25rem 0 .35rem 1.35rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.section-body blockquote p {
  margin: 0;
}

.section-body img {
  width: auto;
  max-width: min(100%, 28rem);
  max-height: 36rem;
  border: 1px solid var(--line);
  display: block;
  object-fit: contain;
}

.site-footer {
  min-height: 50px;
  padding: 16px 0 26px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .08em;
}

.site-footer p {
  margin: 0;
}

.back-to-top {
  position: fixed;
  right: max(1.5rem, calc((100vw - var(--page)) / 2));
  bottom: 1.5rem;
  z-index: 20;
  min-width: 6.5rem;
  min-height: 2.75rem;
  padding: .75rem 1rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  transition: color .18s ease, background-color .18s ease;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--accent);
  color: var(--paper);
}

@media (max-width: 62.5rem) {
  :root {
    --page: calc(100vw - 2.75rem);
  }

  .site-header {
    grid-template-columns: 1fr auto;
  }

  .site-navigation {
    display: none;
  }

  main {
    display: block;
  }

  .page-intro {
    min-height: 23rem;
  }

  .chapter-index {
    position: static;
    max-height: none;
    padding: 1.75rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .chapter-index ol {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .chapter-index a {
    min-height: 3.25rem;
    padding: .65rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .chapter-index li:nth-child(4n) a {
    border-right: 0;
  }

  .chapter-index > p {
    display: none;
  }
}

@media (max-width: 40rem) {
  :root {
    --page: calc(100vw - 1.75rem);
  }

  .site-header {
    min-height: 3.75rem;
    margin-top: .625rem;
  }

  .site-header::after {
    font-size: .5rem;
  }

  .page-intro {
    min-height: 0;
    padding: 2.5rem 0 2rem;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 2rem;
  }

  .page-intro h1 {
    font-size: clamp(3.8rem, 19vw, 5.75rem);
  }

  .page-description {
    font-size: 1rem;
  }


  .chapter-index ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chapter-index li:nth-child(4n) a {
    border-right: 1px solid var(--line);
  }

  .chapter-index li:nth-child(2n) a {
    border-right: 0;
  }

  .section-heading,
  .guide-section--static .section-heading {
    min-height: 6.25rem;
    padding: 1.75rem 0 1.35rem;
    grid-template-columns: 2.7rem minmax(0, 1fr) 1rem;
    gap: .65rem;
  }

  .guide-section--static .section-heading {
    grid-template-columns: 2.7rem minmax(0, 1fr);
  }

  .section-heading h2,
  .section-number {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }

  .section-state {
    display: none;
  }

  .chevron {
    margin-top: .1rem;
  }

  .section-body {
    padding: 0 0 2.75rem;
    font-size: .93rem;
    line-height: 1.9;
  }

  .section-body p,
  .section-body ul,
  .section-body ol,
  .section-body blockquote {
    margin-top: 1.15rem;
  }

  .site-footer {
    display: block;
    padding-right: 7rem;
    line-height: 1.8;
  }

  .back-to-top {
    right: .875rem;
    bottom: .875rem;
    min-width: 5.75rem;
    min-height: 2.625rem;
    padding: .65rem .75rem;
    font-size: .5625rem;
  }
}

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

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
