:root {
  --bg: #efe6d6;
  --paper: #fbf6ee;
  --ink: #221c16;
  --muted: #6b5e51;
  --line: rgba(34, 28, 22, 0.12);
  --seal: #7c2f2b;
  --gold: #8a6a3b;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at top, rgba(255, 250, 242, 0.9), transparent 46%),
    var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  text-size-adjust: 100%;
}

::selection { background: #ead7c2; color: var(--ink); }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  transform: translateY(-150%);
  background: var(--paper);
  padding: 8px 12px;
  z-index: 6;
}

.skip:focus { transform: none; }

.wrap {
  width: min(920px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(251, 246, 238, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.seal {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  background: var(--seal);
  color: #f6efe4;
  box-shadow: inset 0 0 0 2px rgba(246, 239, 228, 0.38);
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
}

.brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.28em;
  line-height: 1.1;
}

.brand em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.18em;
}

.nav {
  display: flex;
  gap: 8px 22px;
  margin-left: auto;
}

.nav a {
  text-decoration: none;
  letter-spacing: 0.16em;
  color: var(--muted);
  padding: 8px 0;
}

.nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--gold);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  letter-spacing: 0.16em;
  padding: 8px 14px;
  min-height: 44px;
}

.hero { padding: 54px 0 10px; text-align: center; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  letter-spacing: 0.32em;
  font-size: 13px;
}

h1, h2, .brand strong, .canon strong, .prose {
  font-family: var(--serif);
}

h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.35;
}

.verse {
  margin: 26px auto 0;
  max-width: 16em;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 2;
  letter-spacing: 0.12em;
}

.lede {
  margin: 22px auto 0;
  max-width: 40em;
  color: var(--muted);
}

@media (min-width: 761px) {
  .lede-line { display: block; }
}

.gates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 36px;
}

.gate {
  display: block;
  min-height: 148px;
  padding: 22px 18px 18px;
  text-decoration: none;
  background: rgba(251, 246, 238, 0.72);
  border: 1px solid var(--gold-soft, rgba(138, 106, 59, 0.35));
}

.gate span {
  color: var(--gold);
  letter-spacing: 0.2em;
  font-family: var(--serif);
}

.gate h2 {
  margin: 10px 0 6px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.gate p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.block { margin-top: 46px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.section-head a, .text-link {
  color: var(--seal);
  letter-spacing: 0.08em;
}

.canon {
  list-style: none;
  margin: 0;
  padding: 0;
}

.canon a {
  display: grid;
  grid-template-columns: 4.5em 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.canon span {
  color: var(--gold);
  letter-spacing: 0.12em;
}

.canon strong {
  font-weight: 500;
  letter-spacing: 0.06em;
}

.rows { display: grid; }

.row {
  display: grid;
  grid-template-columns: 8.5em 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.row time { color: var(--muted); font-size: 14px; }

.row strong {
  display: block;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.row em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-style: normal;
  font-size: 14px;
  line-height: 1.7;
}

.sheet {
  margin-top: 28px;
  margin-bottom: 28px;
  padding: 42px 40px 28px;
  background: var(--paper);
  border: 1px solid rgba(138, 106, 59, 0.35);
  box-shadow: 0 0 0 5px var(--paper), 0 0 0 6px rgba(138, 106, 59, 0.28);
}

.sheet h1 { letter-spacing: 0.08em; font-size: 34px; }

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.crumb a { color: var(--seal); }

.meta { margin: 12px 0 0; color: var(--muted); }

.prose {
  margin-top: 28px;
  font-size: 19px;
  line-height: 2.05;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.prose div, .prose p { margin: 0.35em 0; }

.prose h2, .prose h3, .prose h4 {
  margin: 1.2em 0 0.4em;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.prose a { color: var(--seal); }

.neighbors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 36px;
}

.neighbors a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.neighbors .next { text-align: right; }

.neighbors small { color: var(--gold); letter-spacing: 0.14em; }

.neighbors strong { font-weight: 500; }

.toc { margin-top: 28px; color: var(--muted); }

.toc summary {
  cursor: pointer;
  letter-spacing: 0.12em;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.toc ol { margin: 8px 0 0; padding-left: 1.2em; }

.toc a { color: var(--ink); }

.toc a[aria-current="page"] { color: var(--seal); }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.pager a, .pager span { letter-spacing: 0.08em; }

.empty { color: var(--muted); }

.site-footer {
  margin-top: 28px;
  padding: 28px 0 40px;
  color: var(--muted);
  text-align: center;
}

.site-footer p { margin: 0 auto; max-width: 40em; }

.copy { margin-top: 8px !important; letter-spacing: 0.12em; }

.to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  letter-spacing: 0.08em;
  padding: 10px 12px;
  min-height: 44px;
  opacity: 0;
  pointer-events: none;
}

.to-top.is-on { opacity: 1; pointer-events: auto; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; align-items: center; }

  .nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin: 0;
    padding: 6px 16px 12px;
    flex-direction: column;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }

  .nav.is-open { display: flex; }

  .nav a { min-height: 44px; display: flex; align-items: center; }

  .brand strong { font-size: 24px; letter-spacing: 0.2em; }

  h1, .sheet h1 { font-size: 28px; letter-spacing: 0.08em; }

  .verse { font-size: 18px; }

  .gates, .neighbors, .row { grid-template-columns: 1fr; }

  .row time { font-size: 13px; }

  .sheet {
    padding: 26px 16px 20px;
    box-shadow: none;
  }

  .prose { font-size: 17px; }

  .wrap { width: min(920px, calc(100% - 24px)); }
}

@media print {
  .topbar, .to-top, .site-footer, .neighbors, .toc, .nav-toggle { display: none !important; }
  body { background: #fff; }
  .sheet { border: 0; box-shadow: none; margin: 0; padding: 0; }
}
