:root {
    --cream: #f7f2e8; --cream-deep: #ede7d7; --gold: #7A5C12; --gold-soft: #d4b76e;
    --ink: #2a2118; --ink-soft: #544535; --rule: rgba(42,33,24,0.15); --card: #ffffff;
    --shadow: 0 2px 8px rgba(42,33,24,0.06);
    --selection-bg: var(--gold); --selection-fg: var(--cream);
  }
  :root[data-theme="dark"] {
    --cream: #1a1612; --cream-deep: #0f0c09; --gold: #c9a14a; --gold-soft: #8a6e30;
    --ink: #e8ddc7; --ink-soft: #b8a888; --rule: rgba(232,221,199,0.15); --card: #221d17;
    --shadow: 0 2px 10px rgba(0,0,0,0.4);
    --selection-bg: var(--gold); --selection-fg: var(--cream-deep);
  }
  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body { margin: 0; background: var(--cream); color: var(--ink); font-family: "EB Garamond", Georgia, serif; font-size: 1.06rem; line-height: 1.72; transition: background 0.3s ease, color 0.3s ease; }
  ::selection { background: var(--selection-bg); color: var(--selection-fg); }
  .skip-link { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
  .skip-link:focus { position: fixed; top: 1rem; left: 1rem; width: auto; height: auto; padding: 0.5rem 1rem; background: var(--gold); color: var(--cream); z-index: 1000; text-decoration: none; border-radius: 4px; }
  header.site-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; border-bottom: 1px solid var(--rule); background: var(--cream); position: sticky; top: 0; z-index: 50; backdrop-filter: blur(6px); }
  .crumb { font-family: "IM Fell English", Georgia, serif; font-style: italic; font-size: 0.95rem; color: var(--ink-soft); }
  .crumb a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px dotted var(--gold-soft); }
  .crumb a:hover, .crumb a:focus { color: var(--gold); }
  .controls { display: flex; gap: 0.5rem; }
  .toggle-btn { background: transparent; border: 1px solid var(--rule); color: var(--ink); padding: 0.4rem 0.7rem; border-radius: 4px; cursor: pointer; font-size: 1.1rem; transition: all 0.2s ease; line-height: 1; }
  .toggle-btn:hover, .toggle-btn:focus { border-color: var(--gold); color: var(--gold); outline: none; }
  main { max-width: 720px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }
  .chapter-frame { text-align: center; margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--rule); }
  .chapter-number { font-family: "Cinzel", serif; font-weight: 600; letter-spacing: 0.3em; font-size: 1.05rem; color: var(--gold); margin-bottom: 0.75rem; }
  h1.chapter-title { font-family: "Cinzel", serif; font-weight: 500; font-size: 1.85rem; letter-spacing: 0.08em; line-height: 1.25; margin: 0.25rem 0 1rem; color: var(--ink); }
  .chapter-subtitle { font-family: "IM Fell English", Georgia, serif; font-style: italic; font-size: 1.05rem; color: var(--ink-soft); margin-top: 0.75rem; }
  .chapter-pages { font-family: "IM Fell English", Georgia, serif; font-style: italic; font-size: 0.9rem; color: var(--ink-soft); margin-top: 1.25rem; opacity: 0.8; }
  h2.section-title { font-family: "Cinzel", serif; font-weight: 500; font-size: 1.1rem; letter-spacing: 0.22em; text-align: center; color: var(--gold); margin: 4rem 0 1.5rem; position: relative; }
  h2.section-title::before, h2.section-title::after { content: ""; display: inline-block; width: 2.5rem; height: 1px; background: var(--gold-soft); vertical-align: middle; margin: 0 0.9rem; }
  p { margin: 0 0 1.1rem; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
  p.first-para::first-letter { font-family: "Cinzel", serif; float: left; font-size: 3.2em; line-height: 0.85; padding: 0.15em 0.12em 0 0; color: var(--gold); font-weight: 500; }
  em, cite { font-style: italic; }
  .footnote-ref { font-size: 0.78em; vertical-align: super; line-height: 0; color: var(--gold); text-decoration: none; padding: 0 1px; }
  .footnote-ref:hover, .footnote-ref:focus { color: var(--ink); outline: none; }
  aside.footnotes { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); font-size: 0.92rem; line-height: 1.55; color: var(--ink-soft); }
  aside.footnotes h3 { font-family: "Cinzel", serif; font-size: 0.8rem; letter-spacing: 0.25em; font-weight: 500; color: var(--gold); margin: 0 0 1.25rem; }
  aside.footnotes ol { padding-left: 1.5rem; margin: 0; }
  aside.footnotes li { margin-bottom: 0.6rem; text-align: left; }
  aside.footnotes a { color: var(--gold); text-decoration: none; }
  aside.footnotes a:hover { color: var(--ink); }
  nav.chapter-nav { margin-top: 3rem; padding: 1.5rem 0; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
  nav.chapter-nav a { font-family: "IM Fell English", Georgia, serif; color: var(--gold); text-decoration: none; font-size: 1rem; padding: 0.5rem 0; border-bottom: 1px dotted var(--gold-soft); }
  nav.chapter-nav a:hover, nav.chapter-nav a:focus { color: var(--ink); border-bottom-color: var(--ink); }
  footer.site-foot { max-width: 720px; margin: 0 auto; padding: 2rem 1.5rem 3rem; text-align: center; font-family: "IM Fell English", Georgia, serif; font-style: italic; font-size: 0.9rem; color: var(--ink-soft); border-top: 1px solid var(--rule); }
  footer.site-foot a { color: var(--gold); text-decoration: none; border-bottom: 1px dotted var(--gold-soft); }
  footer.site-foot a:hover { color: var(--ink); border-bottom-color: var(--ink); }
  .ornament { text-align: center; color: var(--gold); margin: 2rem 0; font-size: 1.1rem; letter-spacing: 0.5em; }
  .editorial-note { font-family: "IM Fell English", Georgia, serif; font-style: italic; font-size: 0.95rem; color: var(--ink-soft); background: var(--cream-deep); padding: 1rem 1.25rem; border-left: 3px solid var(--gold-soft); margin: 1.5rem 0 2rem; border-radius: 0 4px 4px 0; }
  .editorial-note strong { font-style: normal; color: var(--gold); font-family: "Cinzel", serif; font-size: 0.78rem; letter-spacing: 0.18em; display: block; margin-bottom: 0.4rem; }
  /* Glossary */
  dl.glossary { margin: 2rem 0; }
  dl.glossary dt { font-family: "Cinzel", serif; font-weight: 500; color: var(--gold); margin: 1.5rem 0 0.4rem; font-size: 1rem; letter-spacing: 0.04em; scroll-margin-top: 5rem; }
  dl.glossary dt .greek { font-family: 'EB Garamond', Georgia, serif; font-style: italic; color: var(--ink-soft); font-weight: 400; letter-spacing: 0; font-size: 0.95rem; }
  dl.glossary dd { margin: 0 0 0.5rem 0; padding-left: 0; text-align: justify; }
  dl.glossary dd a { color: var(--gold); text-decoration: none; border-bottom: 1px dotted var(--gold-soft); }
  dl.glossary dd a:hover { color: var(--ink); }
  /* Glossary index strip */
  .alpha-index { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin: 2rem 0; padding: 1rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  .alpha-index a { font-family: "Cinzel", serif; font-size: 0.85rem; letter-spacing: 0.05em; padding: 0.35rem 0.6rem; border: 1px solid var(--rule); border-radius: 3px; text-decoration: none; color: var(--ink-soft); min-width: 1.8rem; text-align: center; }
  .alpha-index a:hover { color: var(--gold); border-color: var(--gold); }
  /* Bibliography */
  .biblio-section { margin: 2.5rem 0 1rem; }
  .biblio-section h3 { font-family: "Cinzel", serif; font-size: 0.95rem; letter-spacing: 0.18em; color: var(--gold); margin: 0 0 1rem; font-weight: 500; }

  ol.biblio { padding-left: 3rem; list-style-position: outside; margin: 0; }
  ol.biblio li { margin-bottom: 0.85rem; line-height: 1.55; font-size: 0.97rem; padding-left: 0.5rem; }
  ol.biblio li::marker { font-family: "Cinzel", serif; color: var(--gold); font-size: 0.9rem; }
  ol.biblio li[id] { scroll-margin-top: 5rem; }
  /* Index page */
  .index-cols { columns: 2; column-gap: 2rem; margin: 1rem 0; font-size: 0.96rem; }
  @media (max-width: 720px) { .index-cols { columns: 1; } }
  .index-cols p { margin: 0 0 0.4rem; text-align: left; line-height: 1.45; break-inside: avoid; }
  .index-letter { font-family: "Cinzel", serif; font-weight: 600; color: var(--gold); font-size: 1.4rem; letter-spacing: 0.1em; margin: 1.2rem 0 0.6rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--gold-soft); column-span: all; scroll-margin-top: 5rem; }
  .index-cols dfn { font-style: normal; font-weight: 600; color: var(--ink); }
  /* Search box */
  .search-wrap { margin: 1.5rem 0 0.5rem; position: relative; }
  .search-wrap input { width: 100%; padding: 0.7rem 1rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--card); color: var(--ink); font-family: 'EB Garamond', Georgia, serif; font-size: 1rem; }
  .search-wrap input:focus { outline: none; border-color: var(--gold); }
  .search-wrap label { font-family: "IM Fell English", Georgia, serif; font-style: italic; font-size: 0.9rem; color: var(--ink-soft); display: block; margin-bottom: 0.4rem; }
  .search-stats { font-family: "IM Fell English", Georgia, serif; font-style: italic; font-size: 0.85rem; color: var(--ink-soft); text-align: center; margin: 0.5rem 0 1rem; min-height: 1.2em; }
  .index-cols p.hidden, dl.glossary dt.hidden, dl.glossary dt.hidden + dd, ol.biblio li.hidden { display: none; }
  @media (max-width: 600px) {
    main { padding: 2rem 1.1rem 3.5rem; }
    header.site-head { padding: 0.9rem 1rem; }
    h1.chapter-title { font-size: 1.5rem; letter-spacing: 0.06em; }
    body { font-size: 1rem; }
    h2.section-title { font-size: 0.98rem; margin: 3rem 0 1.25rem; }
    h2.section-title::before, h2.section-title::after { width: 1.25rem; margin: 0 0.5rem; }
    nav.chapter-nav { flex-direction: column; align-items: flex-start; }
  }
  @media print {
    body { background: white; color: black; font-size: 11pt; }
    header.site-head, .controls, footer.site-foot, .skip-link, nav.chapter-nav, .search-wrap, .search-stats, .alpha-index { display: none; }
    main { max-width: 100%; padding: 0; }
    p.first-para::first-letter, h1.chapter-title, h2.section-title, .chapter-number { color: black; }
    h2.section-title::before, h2.section-title::after { background: black; }
    a { color: black; }
    aside.footnotes { border-top-color: black; color: black; }
    .index-cols { columns: 2; }
    .editorial-note { background: white; border-left-color: black; }
    .editorial-note strong { color: black; }
  }

/* skip-link:begin */
.skip-link{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0}
.skip-link:focus{position:fixed;top:.75rem;left:.75rem;z-index:1000;width:auto;height:auto;margin:0;padding:.6rem 1rem;overflow:visible;clip:auto;clip-path:none;background:#2a1a08!important;color:#FAF5EB!important;font-family:'Cinzel',Georgia,serif;font-size:.8rem;letter-spacing:.08em;text-decoration:none;border-radius:3px;outline:2px solid #FAF5EB;outline-offset:-4px;box-shadow:0 0 0 2px #2a1a08,0 0 0 4px #FAF5EB}
/* skip-link:end */
