:root {
  --paper: #FFFFFF;
  --paper-panel: #F3E7CE;
  --card: #FFFDF8;
  --ink: #2B2116;
  --ink-soft: #6B5D48;
  --accent: #7A2E22;
  --accent-bright: #9C4433;
  --line: rgba(43, 33, 22, 0.16);
  --line-soft: rgba(43, 33, 22, 0.09);
  --display: "Lora", Georgia, "Times New Roman", serif;
  --body: "Lora", Georgia, "Times New Roman", serif;
  --ui: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-size: 1.05rem;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; }
a:hover { color: var(--accent-bright); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; color: var(--ink); line-height: 1.2; }

/* ---------- Header ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 24px;
  padding: 18px 24px; flex-wrap: wrap;
}
.brand {
  display: flex; flex-direction: column; text-decoration: none; color: var(--ink);
}
.brand b {
  font-family: var(--display); font-weight: 700; font-size: 1.4rem; letter-spacing: 0.01em;
}
.brand span {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
}
.top-nav { display: flex; gap: 22px; margin-left: auto; font-family: var(--ui); font-size: 0.95rem; }
.top-nav a { text-decoration: none; color: var(--ink); }
.top-nav a:hover { color: var(--accent); }

/* ---------- Page shell (sidebar + content) ---------- */
.page-shell {
  max-width: 1180px; margin: 0 auto;
  padding: 36px 24px 80px;
  display: grid; grid-template-columns: 280px minmax(0, 1fr);
  gap: 44px; align-items: start;
}

/* ---------- Sidebar ---------- */
.sidebar-nav {
  background: var(--paper-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 4px;
  position: sticky; top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  font-family: var(--ui);
  font-size: 0.9rem;
}
.sidebar-toggle-label {
  display: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  list-style: none;
}
.sidebar-toggle-label::-webkit-details-marker { display: none; }
.sidebar-toggle-label::after { content: "▾"; float: right; color: var(--accent); }
details[open] > .sidebar-toggle-label::after { content: "▴"; }

.nav-tree, .nav-tree ul { list-style: none; }
.nav-tree { padding: 8px; }
.nav-tree ul { padding-left: 14px; border-left: 1px solid var(--line-soft); margin-left: 6px; }
.nav-tree li { margin: 1px 0; }
.nav-tree > li { margin-top: 2px; }

.nav-tree a {
  display: block; padding: 6px 8px; border-radius: 6px;
  text-decoration: none; color: var(--ink);
}
.nav-tree a:hover { background: rgba(122, 46, 34, 0.08); color: var(--accent); }
.nav-tree a.current { background: var(--accent); color: #FFFDF8; font-weight: 600; }

.nav-tree summary {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  font-weight: 500; list-style: none;
}
.nav-tree summary::-webkit-details-marker { display: none; }
.nav-tree summary::before { content: "▸"; font-size: 0.7em; color: var(--accent); transition: transform 0.15s ease; }
.nav-tree details[open] > summary::before { transform: rotate(90deg); }
.nav-tree summary:hover { background: rgba(122, 46, 34, 0.08); }
.nav-tree summary a { display: inline; padding: 0; flex: 1; }
.nav-tree summary a:hover { background: none; }

/* ---------- Content ---------- */
.content { min-width: 0; }
.breadcrumb {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft);
  margin-bottom: 14px; word-break: break-word;
}
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.content h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 22px; }
.content-body { max-width: 68ch; }
.content-body p { margin-bottom: 1.1em; color: var(--ink); }
.content-body ul, .content-body ol { margin: 0 0 1.1em 1.4em; }
.content-body li { margin-bottom: 0.4em; }
.content-body strong { color: var(--ink); }
.content-body img { border-radius: 8px; margin: 1.2em 0; }
.content-body figure { margin: 1.2em 0; }
.content-body figcaption { font-size: 0.85rem; color: var(--ink-soft); margin-top: 6px; }
.content-empty-note { color: var(--ink-soft); font-style: italic; margin-bottom: 1.4em; }

.section-list-heading {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
  margin: 40px 0 12px;
}
.section-list {
  list-style: none; max-width: 68ch;
  border-top: 1px solid var(--line);
}
.section-list li { border-bottom: 1px solid var(--line); }
.section-list a {
  display: block; padding: 13px 4px; text-decoration: none; color: var(--ink);
  font-family: var(--ui); font-size: 0.98rem;
}
.section-list a:hover { color: var(--accent); }

.page-nav { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.page-nav a {
  font-family: var(--ui); font-size: 0.9rem; text-decoration: none;
  color: var(--ink-soft);
}
.page-nav a:hover { color: var(--accent); }

/* ---------- Homepage ---------- */
.hero {
  background:
    linear-gradient(180deg, rgba(43, 33, 22, 0.74) 0%, rgba(43, 33, 22, 0.52) 50%, rgba(43, 33, 22, 0.84) 100%),
    url('img/hero-signpost.jpg');
  background-size: cover;
  background-position: center 38%;
  border-bottom: 1px solid var(--line);
  padding: 96px 24px 88px; text-align: center;
}
.hero .wrap { max-width: 780px; }
.hero .eyebrow {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--paper);
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem); margin: 14px 0 20px;
  color: #FFFDF8;
}
.hero .quote {
  font-size: 1.2rem; font-style: italic; color: rgba(255, 253, 248, 0.88);
  margin-bottom: 26px;
}
.btn {
  display: inline-block; font-family: var(--ui); font-weight: 600;
  background: var(--accent); color: #FFFDF8;
  padding: 12px 28px; border-radius: 6px; text-decoration: none;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--accent-bright); color: #FFFDF8; }

.home-section { padding: 56px 24px; max-width: 1180px; margin: 0 auto; }
.home-section h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.1rem); margin-bottom: 8px;
}
.home-section .section-intro { color: var(--ink-soft); max-width: 640px; margin-bottom: 32px; }

.library-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.library-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px; text-decoration: none; color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.library-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(43, 33, 22, 0.1); }
.library-card b {
  display: block; font-family: var(--display); font-size: 1.15rem; margin-bottom: 6px;
}
.library-card span {
  font-family: var(--ui); font-size: 0.85rem; color: var(--ink-soft);
}

.about-preview { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 32px; max-width: 780px; }
.about-preview p { color: var(--ink-soft); margin-bottom: 14px; }
.about-preview a { font-family: var(--ui); font-weight: 600; text-decoration: none; }

/* ---------- Contact ---------- */
.contact-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 36px; max-width: 560px;
}
.contact-card p { margin-bottom: 20px; color: var(--ink-soft); }

/* ---------- Footer ---------- */
footer { background: var(--paper-panel); border-top: 1px solid var(--line); }
.foot-inner {
  max-width: 1180px; margin: 0 auto; padding: 40px 24px;
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between;
  font-family: var(--ui); font-size: 0.85rem; color: var(--ink-soft);
}
footer a { color: var(--ink-soft); }
footer a:hover { color: var(--accent); }

@media (max-width: 880px) {
  .page-shell { grid-template-columns: 1fr; }
  .sidebar-nav { position: static; max-height: none; }
  .sidebar-toggle-label { display: block; }
  .top-nav { gap: 14px; }
}
