:root {
  color-scheme: light;
  --paper: #f8f5f1;
  --surface: #fffdfb;
  --ink: #262321;
  --muted: #615b56;
  --line: #e5dcd4;
  --accent: #b51225;
  --accent-dark: #8f0e1e;
  --accent-soft: #f6e7e7;
  --sidebar-width: 264px;
  font: 16px/1.55 "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent-dark); text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[id] { scroll-margin-block-start: 24px; }
.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus {
  position: fixed;
  z-index: 10;
  top: 10px;
  left: 12px;
  padding: 7px 12px;
  border-radius: 6px;
  background: white;
}

.site-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  align-items: start;
  min-height: 100dvh;
  max-width: 1550px;
  margin-inline: auto;
}
.guide-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  padding: 22px 16px 24px;
  border-inline-end: 1px solid var(--line);
  background: var(--surface);
  scrollbar-width: thin;
}
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
  color: var(--ink);
  font-size: .98rem;
  font-weight: 700;
  text-decoration: none;
}
.brand-mark {
  flex: 0 0 39px;
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}
.brand-mark img { display: block; width: 27px; height: 29px; object-fit: contain; }
.sidebar-search {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 18px 0 0;
  padding: 7px 10px;
  border: 1px solid #dbcdc2;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: .93rem;
  font-weight: 600;
}
.sidebar-search:hover { border-color: #bc8d91; background: var(--accent-soft); }
.search-icon {
  display: inline-block;
  position: relative;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0 3px 3px 0;
  border: 1.6px solid currentColor;
  border-radius: 50%;
  color: var(--accent-dark);
}
.search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 1.6px;
  top: 10px;
  left: 10px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: 0 50%;
}
.menu-rail, .sidebar-close { display: none; }
.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
}
.icon-button:hover { background: #ede5df; }
.sidebar-close { display: none; flex: 0 0 36px; }
.close-button::before, .close-button::after {
  content: "";
  position: absolute;
  width: 17px;
  height: 1.6px;
  background: currentColor;
  transform: rotate(45deg);
}
.close-button::after { transform: rotate(-45deg); }
.menu-icon { width: 18px; height: 2px; border-radius: 3px; background: currentColor; box-shadow: 0 -6px currentColor, 0 6px currentColor; }

.tree { margin-top: 19px; }
.tree ul, .search-results { list-style: none; padding: 0; margin: 0; }
.tree li + li { margin-top: 2px; }
.tree > ul > .tree-group:not(:first-child) { margin-top: 21px; }
.tree-group h2 { margin: 0 9px 5px; color: var(--muted); font-size: .82rem; font-weight: 700; overflow-wrap: anywhere; }
.tree-link, .tree summary {
  position: relative;
  display: block;
  padding: 7px 9px;
  border-radius: 5px;
  color: var(--ink);
  font-size: .9rem;
  line-height: 1.4;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.tree-link:hover, .tree summary:hover { background: #f1ebe5; }
.tree-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.tree-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  inset: 5px auto 5px 0;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.tree summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
}
.tree details[open] > summary::after { transform: translateY(-2px) rotate(45deg); }
.tree-branch details > ul, .article-outline nav { margin: 2px 0 5px 10px; padding-inline-start: 8px; border-inline-start: 1px solid var(--line); }
.article-outline { margin: 3px 0 5px 6px; }
.article-outline summary, .article-outline a { color: var(--muted); font-size: .81rem; }
.article-outline a { display: block; padding: 4px 6px; overflow-wrap: anywhere; text-decoration: none; }
.article-outline a:hover { text-decoration: underline; }
.article-outline a[aria-current] { color: var(--accent-dark); font-weight: 700; }
.toc-level-3 { padding-inline-start: 6px; }
.toc-level-4, .toc-level-5, .toc-level-6 { padding-inline-start: 12px; }

.main-content { min-width: 0; padding: 46px clamp(22px, 5vw, 70px) 56px; }
.article, .empty-site { max-width: 730px; margin-inline: auto; }
.article-title { margin-bottom: 26px; }
.article h1, .empty-site {
  margin-block: 0;
  font-size: clamp(2rem, 3.5vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -.038em;
  overflow-wrap: anywhere;
}
.empty-site { margin-block: 13vh 0; font-size: clamp(1.6rem, 3vw, 2.55rem); color: #413b36; }
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 16px;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: .87rem;
}
.prose { line-height: 1.69; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1rem; }
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { margin: 25px 0 8px; font-weight: 700; line-height: 1.22; letter-spacing: -.015em; }
.prose h2 { font-size: 1.52rem; }
.prose h3 { font-size: 1.23rem; }
.prose h4, .prose h5, .prose h6 { font-size: 1.04rem; }
.prose :is(ol, ul) { margin: 7px 0 17px; padding-inline-start: 1.6em; }
.prose li { margin-bottom: 7px; padding-inline-start: 3px; }
.prose li::marker { color: var(--accent-dark); font-weight: 650; }
.prose li > p { margin: 0 0 5px; }
.prose li > :is(ol, ul) { margin: 6px 0; }
.prose blockquote { margin: 16px 0; padding: 6px 14px; border-inline-start: 3px solid var(--accent); background: #f1e9e1; }
.prose pre, .table-scroll { overflow-x: auto; }
.prose table { min-width: max-content; margin-bottom: 1em; border-collapse: collapse; }
.prose :is(td, th) { padding: 7px 9px; border: 1px solid #d9cec6; text-align: start; }
.prose th { background: #f1e6dd; }
.prose img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; cursor: zoom-in; }
.zoomable:has(> img) { display: block; }
.prose .video { margin: 14px 0; }
.prose video { display: block; max-width: 100%; max-height: 500px; border-radius: 8px; }

dialog {
  max-width: calc(100% - 20px);
  max-height: min(85dvh, calc(100% - 20px));
  border: 1px solid #dbcec4;
  border-radius: 11px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 15px 65px #271a1b32;
}
dialog::backdrop { background: #241c1b9e; }
html:has(dialog[open], .menu-open) { overflow: hidden; }
.image-dialog[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - clamp(28px, 8vw, 112px));
  max-height: calc(100dvh - clamp(28px, 10dvh, 112px));
  padding: 8px;
}
.image-dialog form { flex: none; align-self: flex-end; }
.image-dialog img { display: block; min-height: 0; max-width: 100%; object-fit: contain; }
.image-dialog-link { flex: none; }
.search-dialog[open] { display: flex; flex-direction: column; width: 580px; margin: min(13dvh, 95px) auto auto; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 13px 6px 18px; }
.dialog-header h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.02em; }
.search-form { padding: 0 18px; }
.search-field { display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #ac9d94; border-radius: 7px; }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.search-field input { width: 100%; min-width: 0; height: 43px; border: 0; outline: none; color: var(--ink); background: transparent; }
.search-field input::placeholder { color: var(--muted); }
.search-status { margin: 11px 18px 13px; color: var(--muted); font-size: .87rem; }
.search-results { min-height: 0; overflow-y: auto; }
.search-results:not(:empty) { padding: 0 13px 12px; }
.search-results li + li { border-top: 1px solid var(--line); }
.search-results a { display: block; padding: 9px 5px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.search-results a:hover strong { color: var(--accent-dark); text-decoration: underline; }
.search-results a:focus-visible { outline-offset: -2px; }
.search-results span { display: block; color: var(--muted); font-size: .86rem; }
.search-results .result-trail { color: var(--accent-dark); font-size: .78rem; }

@media (max-width: 780px) {
  .site-shell { grid-template-columns: 46px minmax(0, 1fr); }
  .menu-rail {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: sticky;
    top: 0;
    height: 100dvh;
    padding-top: 9px;
    border-inline-end: 1px solid var(--line);
    background: var(--surface);
  }
  .menu-toggle { width: 36px; }
  .guide-sidebar {
    display: none;
    position: fixed;
    z-index: 4;
    inset: 0 auto 0 0;
    width: min(310px, calc(100% - 36px));
    padding-top: 15px;
  }
  .menu-open .guide-sidebar { display: block; }
  .sidebar-close { display: inline-grid; }
  .sidebar-backdrop { position: fixed; z-index: 3; inset: 0; background: #241c1b86; }
  .main-content { padding: 25px clamp(14px, 4vw, 28px) 38px; }
  .article-title { margin-bottom: 18px; }
  .article h1 { font-size: clamp(1.65rem, 5vw, 2.2rem); }
  .prose h2 { font-size: 1.31rem; }
}
