:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f6f1e7;
  --panel: #efe8da;
  --panel-card: #fbf8f1;
  --header-bg: #f0e9dc;
  --header-border: #cbbfa8;
  --ink: #1f1911;
  --muted: #685b48;
  --line: #d8ccb6;
  --gold: #8b6914;
  --accent: #8a3d18;
  --label-bg: rgba(240, 233, 220, 0.95);
  --context-bg: rgba(240, 233, 220, 0.96);
  --drawer-bg: #f7f2e8;
  --nav-hover: rgba(139, 105, 20, 0.12);
  --menu-hover: #e2d6c1;
  --shadow-color: rgba(40, 30, 15, 0.15);
  font-family: system-ui,-apple-system,"Segoe UI",sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101112;
  --panel: #191b1d;
  --panel-card: #141617;
  --header-bg: #141617;
  --header-border: #64583e;
  --ink: #f2f3f1;
  --muted: #b0b5b4;
  --line: #363b3c;
  --gold: #d9bc7b;
  --accent: #a8dece;
  --label-bg: rgba(17, 20, 20, 0.95);
  --context-bg: rgba(17, 20, 20, 0.96);
  --drawer-bg: #191b1d;
  --nav-hover: rgba(217, 188, 123, 0.14);
  --menu-hover: #353d3c;
  --shadow-color: rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; letter-spacing: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.6; transition: background 0.2s ease, color 0.2s ease; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold); }
a:focus-visible,button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
p,h1,h2,h3 { margin-top: 0; }
h1,h2,h3 { line-height: 1.2; }
h1,h2 { font-family: Georgia,"Times New Roman",serif; font-weight: 400; }
h2 { font-size: 28px; }
h3 { font-size: 17px; font-weight: 600; }
p { color: var(--muted); }

.site-header {
  position: fixed; inset: 0 0 auto; z-index: 30;
  min-height: 64px;
  padding: 12px max(24px,calc((100% - 1240px)/2));
  border-top: 1px solid var(--header-border);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--header-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--header-bg);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand {
  font: 600 12px/1.4 system-ui;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--header-border);
  border-radius: 4px;
  background: var(--panel);
  white-space: nowrap;
}
.brand span { color: var(--gold); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.header-nav a, .search-link, .section-heading a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  white-space: nowrap;
  font-size: 13px;
  transition: color 0.15s, border-color 0.15s;
}
.header-nav a:hover, .search-link:hover, .section-heading a:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.iconbtn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.iconbtn:hover, .iconbtn:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
}
.iconbtn svg {
  width: 18px;
  height: 18px;
}

/* Sun / Moon Theme Icon Toggle */
.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

/* Navigation Drawer */
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(340px, 86vw);
  background: var(--drawer-bg);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 28px var(--shadow-color);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.nav-drawer.open {
  transform: translateX(0);
}
.nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.nav-scrim.open {
  opacity: 1;
  pointer-events: auto;
}
.nav-inner {
  padding: 20px 20px calc(28px + env(safe-area-inset-bottom, 0px));
}
.nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.nav-brand {
  font: 600 13px/1.2 system-ui, sans-serif;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.nav-brand span {
  color: var(--gold);
}
.nav-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.nav-close:hover {
  color: var(--gold);
  border-color: var(--gold);
}
.nav-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin: 0 0 10px 4px;
}
.drawer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.drawer-links li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.drawer-links li a:hover {
  background: var(--nav-hover);
  color: var(--gold);
}
.drawer-num {
  font: 12px ui-monospace, monospace;
  color: var(--gold);
  opacity: 0.9;
  min-width: 22px;
}
main { max-width: 1288px; margin: auto; padding: 0 24px 86px; }
.introduction { padding: 32px 0 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.introduction h1 { font-size: 48px; margin-bottom: 14px; }
.lead { font-size: 20px; color: var(--ink); margin-bottom: 6px; }
.intro-context { margin: 0; font-size: 16px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 20px; }
.section-heading h2 { font-size: 24px; margin: 0; }
.section-heading a { font-size: 14px; white-space: nowrap; color: var(--muted); }
.image-nodes { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; }
.image-node { min-width: 0; position: relative; display: block; aspect-ratio: 1; background: var(--panel-card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; transition: border-color .18s, box-shadow .18s; }
.image-node:hover,.image-node:focus-visible { border-color: var(--gold); color: var(--ink); box-shadow: 0 6px 20px var(--shadow-color); }
.node-image { position: absolute; inset: 0; padding-bottom: 36px; background: var(--panel-card); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.node-image img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 38%; }
.node-label { position: absolute; inset: auto 0 0; display: grid; place-items: center; height: 36px; padding: 3px 6px; border-top: 1px solid var(--line); background: var(--label-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--ink); text-align: center; font: 600 12px/1.2 system-ui,sans-serif; text-transform: uppercase; transition: color 0.15s, border-color 0.15s; }
.node-label>span { display: none; }
.image-node:hover .node-label,.image-node:focus-visible .node-label { color: var(--gold); border-top-color: var(--gold); }
.node-context { min-height: 52px; padding: 14px 0; margin: 0; font-size: 14px; }
.starting-paths { padding: 30px 0 38px; border-top: 1px solid var(--line); margin-top: 12px; }
.paths { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 30px; }
.paths>a { display: flex; gap: 14px; align-items: start; padding: 12px 0; }
.path-number { font: 14px ui-monospace,monospace; color: var(--gold); padding-top: 3px; }
.paths h3 { margin: 0 0 9px; }
.paths p { font-size: 15px; margin: 0; }
.paths>a>span:last-child { color: var(--gold); }
.home-page .paths>a { background: var(--panel); }
.reading-note { display: grid; grid-template-columns: 1fr 1.3fr; gap: 60px; border-top: 1px solid var(--line); padding: 38px 0; }
.reading-note h2 { max-width: 18ch; font-size: 30px; }
.reading-note a { text-decoration: underline; text-underline-offset: 4px; color: var(--accent); }
.reading-note p { font-size: 15px; }
.reading-note .eyebrow { font-size: 12px; }
.page-footer { border-top: 1px solid var(--line); padding: 24px 0; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 13px; }
.page-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.context-bar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; min-height: 54px; background: var(--context-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 8px max(24px,calc((100% - 1240px)/2)); padding-bottom: max(8px,env(safe-area-inset-bottom)); font-size: 12px; }
.context-bar>span { color: var(--gold); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-bar nav { margin-left: auto; display: flex; gap: 8px; }
.context-bar nav a,.back-top { display: grid; place-items: center; height: 36px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); }
.context-bar nav a { min-width: 88px; padding: 0 12px; font-weight: 600; text-transform: uppercase; }
.context-bar nav a:hover,.back-top:hover { border-color: var(--gold); color: var(--gold); }
.back-top { width: 36px; flex: 0 0 36px; font-size: 17px; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px; }
.skip-link:focus { top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#node-menu { position: fixed; z-index: 30; width: 220px; padding: 6px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 8px 32px var(--shadow-color); border-radius: 6px; }
#node-menu[hidden] { display: none; }
#node-menu a,#node-menu button { display: block; text-align: left; padding: 10px; width: 100%; background: none; border: none; border-radius: 3px; font-size: 14px; color: var(--ink); }
#node-menu a:hover,#node-menu button:hover { background: var(--menu-hover); color: var(--ink); }
.article-main { max-width: 880px; padding-top: 40px; }
.article-main h1 { font-size: 42px; }
.article-main h2 { margin-top: 36px; }
.article-main a { color: var(--accent); text-decoration: underline; }
.article-main li { margin-bottom: 10px; color: var(--muted); }
@media(max-width:800px) {
  .site-header { padding-left: 20px; padding-right: 20px; }
  .introduction h1 { font-size: 40px; }.image-nodes { gap: 12px; }
  .paths { grid-template-columns: 1fr; gap: 6px; }.paths>a { border-bottom: 1px solid var(--line); padding: 16px 0; }
  .reading-note { gap: 26px; }.context-bar { padding-left: 20px; padding-right: 20px; }
}
@media(max-width:680px) {
  .header-nav { display: none; }
}
@media(max-width:600px) {
  .site-header { padding: 10px 12px; gap: 6px; min-height: 60px; }
  .brand { display: grid; gap: 0; font-size: 10px; line-height: 1.25; padding: 5px 8px; min-height: 38px; }
  .search-link { font-size: 11px; padding: 5px 7px; }
  .iconbtn { width: 36px; height: 36px; }
  .iconbtn svg { width: 17px; height: 17px; }
  main { padding: 0 18px 84px; }.introduction { padding: 28px 0 26px; }.introduction h1 { font-size: 32px; }
  .lead { font-size: 18px; }.intro-context { font-size: 14px; }.section-heading h2 { font-size: 21px; }.section-heading { gap: 10px; }.section-heading a { font-size: 12px; padding: 5px 8px; }
  .image-nodes { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .node-label { font-size: 11px; }.node-context { min-height: 70px; }
  .reading-note { grid-template-columns: 1fr; gap: 6px; padding: 28px 0; }.reading-note h2 { font-size: 28px; max-width: none; }
  .page-footer { flex-direction: column; font-size: 12px; gap: 12px; }.context-bar { padding-left: 12px; padding-right: 12px; gap: 8px; font-size: 11px; }
  .context-bar>span { display: none; }.context-bar nav { margin: 0; flex: 1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
  .context-bar nav a { min-width: 0; padding: 0 6px; }
  .article-main { padding-top: 28px; }.article-main h1 { font-size: 32px; }
}
@media(max-width:360px) {
  .site-header { gap:4px; padding-left:8px; padding-right:8px; }
  .search-link { padding-left:5px; padding-right:5px; font-size: 10px; }
  .brand { padding-left:5px; padding-right:5px; font-size: 9px; }
  .iconbtn { width: 32px; height: 32px; }
  .iconbtn svg { width: 15px; height: 15px; }
}
@media(prefers-reduced-motion:reduce) {
  html { scroll-behavior: auto; }
  .image-node,.node-image img { transition: none; }
  .image-node:hover,.image-node:hover img { transform: none; }
  .nav-drawer,.nav-scrim { transition: none; }
}

/* Fixed shared chrome reserves its measured height without moving page content. */
:root{--site-header-height:64px}
body{padding-top:var(--site-header-height)}
.site-header{position:fixed;inset:0 0 auto;z-index:20;box-shadow:0 1px 0 var(--header-border)}
.context-bar{z-index:20}
html{scroll-padding-top:calc(var(--site-header-height) + 16px);scroll-padding-bottom:80px}
.section-nav a,.context-bar a,.brand,.site-header nav a,.search-link{letter-spacing:0}
@media(max-width:600px){:root{--site-header-height:60px}}
