@charset "UTF-8";
/* Book Reader 2026 — stable 4-pane baseline (v4) */

:root{
  --paper:#fffff8;
  --ink:#111827;
  --muted:#4b5563;
  --line:#e5e7eb;
  --accent:#1d4ed8;
  --hit:#f59e0b;

  --tocW:280px;
  --mainW:1fr;
  --notesW:340px;
  --resW:300px;

  --textW:720px;

  --radius:14px;
  --pad:12px;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --serif: ui-serif, Georgia, "Times New Roman", Times, serif;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  overflow:hidden;
}

a{ color:var(--accent); text-decoration:none; }
a:hover{ text-decoration:underline; }

/* 4-pane grid (stable: panes are pinned to columns) */
.app{
  height:100vh;
  display:grid;
  grid-template-columns: var(--tocW) var(--mainW) var(--notesW) var(--resW);
  gap:10px;
  padding:10px;
  min-width:0;
  min-height:0;
}

/* Pin panes to columns so hiding one does NOT reshuffle the others */
#tocPane{ grid-column:1; }
#mainPane{ grid-column:2; }
#endnotesPane{ grid-column:3; }
#resourcesPane{ grid-column:4; }

/* Collapse ToC: shrink column 1 to 0 and hide the pane */
.app.toc-collapsed,
.app.doc-collapsed{
  grid-template-columns: 0 var(--mainW) var(--notesW) var(--resW);
}
.app.toc-collapsed #tocPane,
.app.doc-collapsed #tocPane{
  display:none;
}

/* Responsive: stack Resources under Endnotes */
@media (max-width: 1400px){
  .app{
    grid-template-columns: var(--tocW) 1fr var(--notesW);
    grid-template-rows: 1fr 1fr;
  }
  #tocPane{ grid-column: 1; grid-row: 1 / span 2; }
  #mainPane{ grid-column: 2; grid-row: 1 / span 2; }
  #endnotesPane{ grid-column: 3; grid-row: 1; }
  #resourcesPane{ grid-column: 3; grid-row: 2; }

  .app.toc-collapsed,
  .app.doc-collapsed{
    grid-template-columns: 0 1fr var(--notesW);
  }
  .app.toc-collapsed #tocPane,
  .app.doc-collapsed #tocPane{
    display:none;
  }
}

/* Responsive: stack all */
@media (max-width: 900px){
  body{ overflow:auto; }
  .app{
    height:auto;
    grid-template-columns: 1fr;
    grid-template-rows:auto;
  }
  .pane{ height:70vh; }

  /* On small screens, never fully hide ToC */
  .app.toc-collapsed #tocPane,
  .app.doc-collapsed #tocPane{
    display:block;
  }
}


.pane{
  border:1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:0;
}

.header{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px var(--pad);
  border-bottom:1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 2;
}
.header h2{
  margin:0;
  font-size:13px;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--muted);
  font-weight:700;
}
.meta{
  margin-left:auto;
  color:var(--muted);
  font-size:13px;
  font-family:var(--mono);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  min-width: 0;
  max-width:60%;
}

.body{
  flex:1 1 auto;
  overflow:auto;
  padding: var(--pad);
  min-height:0;
}

/* small UI buttons */
.uiBtn{
  border:1px solid var(--line);
  background: var(--paper);
  border-radius:999px;
  padding:6px 10px;
  cursor:pointer;
  font-size:13px;
  color:var(--ink);
  white-space:nowrap;
  min-width: 0;
}
.uiBtn:hover{ background: rgba(0,0,0,0.03); }

/* TOC */
.search{
  width:100%;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  outline:none;
  font-size:14px;
}
.tocControls{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-bottom:10px;
}
.tocToggle{
  display:flex;
  gap:8px;
  align-items:center;
  font-size:13px;
  color:var(--muted);
  user-select:none;
}
.tocHelp{
  font-size:12px;
  color:var(--muted);
  margin:0;
}

.tocList{ margin:0; padding:0; list-style:none; }
.tocGroup{
  margin-top:10px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid var(--line);
  background: var(--paper);
  font-size:12px;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--muted);
  font-weight:700;
}

.tocBtn{
  width:100%;
  text-align:left;
  background:transparent;
  border:1px solid transparent;
  padding:8px 10px;
  border-radius:10px;
  cursor:pointer;
  color:var(--ink);
  display:flex;
  gap:8px;
  align-items:baseline;
}
.tocBtn:hover{ background: rgba(0,0,0,0.03); }
.tocKind{
  font-family:var(--mono);
  font-size:12px;
  color:var(--muted);
  width:44px;
  flex:0 0 auto;
}
.tocTitle{
  font-size:14px;
  line-height:1.25;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  min-width: 0;
  flex:1 1 auto;
  min-width:0;
}
.tocBtn.level-2 .tocTitle{ padding-left: 14px; }
.tocBtn.level-3 .tocTitle{ padding-left: 28px; }
.tocBtn.level-4 .tocTitle{ padding-left: 42px; font-size:13px; }
/* ToC: always show H2/H3/H4; remove the "Show headings" control */
#tocAllLevels{ display:none !important; }
label[for="tocAllLevels"]{ display:none !important; }

/* ToC: caret + kind columns for consistent indentation */
.tocCaret{
  font-family:var(--mono);
  font-size:12px;
  color:var(--muted);
  width:24px;
  flex:0 0 auto;
  text-align:center;
  cursor:pointer;
  user-select:none;
}
.tocKind{ user-select:none; }


/* Main */
#mainPane .body{ padding:0; }
.paper{
  max-width: var(--textW);
  margin: 0 auto;
  padding: 24px 28px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.62;
  min-height: 100%;
}

.paper p{ margin: 0 0 0.9em 0; }
.paper h2,.paper h3,.paper h4{ font-family: var(--sans); }
.paper sup{ font-size:0.8em; }
.paper .footnote-ref{ font-family:var(--sans); font-size:0.85em; }
.paper .pn{
  font-weight:700;
  color:var(--muted);
  font-family:var(--sans);
  font-size:0.92em;
}

/* Commonly used css code in my website */

.center{
  text-align: center;
}
.flush-left {
	text-indent: 0px;
}
.flush-right {
	text-align: right;
}

/* Quote paragraphs (bilingual tables) */
.paper p.quote{
  font-size: 0.92em;
  line-height: 1.42;
}
#endnotesContent p.quote,
#resourcesContent p.quote{
  font-size: 0.95em;
  line-height: 1.42;
}

/* Sticky chapter heading bar (inside paper) */
.chapterBar{
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -8px -8px 14px -8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font-family: var(--sans);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.chapterBar strong{
  color: var(--ink);
  letter-spacing: 0;
  text-transform:none;
  font-weight:700;
  font-size: 14px;
}

/* Prev/Next at bottom */
.chapterNav{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.navBtn{
  border:1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding:10px 12px;
  cursor:pointer;
  font-size:14px;
  color: var(--ink);
}
.navBtn:hover{ background: rgba(0,0,0,0.03); }
.navBtn[disabled]{ opacity:0.5; cursor:default; }

/* ¶ permalinks */
.paper p[id]{ position:relative; scroll-margin-top: 14px; }
.plink{
  position:absolute;
  left:-22px;
  top:0.05em;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1;
  opacity:0;
  transition: opacity 120ms ease;
  border:1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  border-radius: 8px;
  padding: 3px 6px;
  cursor:pointer;
  user-select:none;
}
.paper p[id]:hover .plink{ opacity:1; }

.par-hit{
  outline: 2px solid var(--hit);
  border-radius: 10px;
  padding: 6px;
  margin-left: -6px;
  background: rgba(245, 158, 11, 0.10);
}

/* Endnotes + Resources typography */
#endnotesContent, #resourcesContent{
  font-family: var(--sans);
  font-size:14px;
  line-height:1.45;
}
#endnotesContent ol, #resourcesContent ol{ padding-left: 22px; }

.note-hit{
  outline: 2px solid var(--hit);
  border-radius: 10px;
  padding: 6px;
  margin-left: -6px;
  background: rgba(245, 158, 11, 0.10);
}

/* Resources tabs (optional) */
.tabs{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-left:auto;
  justify-content:flex-end;
}
.tabBtn{
  border:1px solid var(--line);
  background: var(--paper);
  border-radius:999px;
  padding:6px 10px;
  cursor:pointer;
  font-size:13px;
  color:var(--ink);
  white-space:nowrap;
  min-width: 0;
}
.tabBtn.active{
  background: rgba(29,78,216,0.10);
  border-color: rgba(29,78,216,0.35);
}

.hint{ color:var(--muted); font-size:13px; margin:0; }

/* =========================
   Media (Figures/Equations/Greek)
   ========================= */

/* Never let images overflow the panes */
#mainPane img,
#endnotesPane img,
#resourcesPane img {
  max-width: 100%;
  height: auto;
}

/* Block figures/equations */
p.center,
p.equation {
  text-align: center;
  margin: 0.75em 0;
}

p.center img,
p.equation img {
  display: block;
  margin: 0 auto;
}

/* Inline Greek / small glyph images */
img.inline-greek,
img[src*="images/grec/"],
img[src*="images/greek/"] {
  display: inline;
  vertical-align: -0.25em;
}



/* ===== Final tweaks (v2): Resources header layout + default placeholder ===== */
#resourcesPane .header{
  flex-direction: column;
  align-items: flex-start;
}
#resourcesPane .header h2{
  width: 100%;
}
#resourcesPane .tabs{
  margin-left: 0;
  justify-content: flex-start;
  width: 100%;
}
#resourcesPane .tabs .tabBtn{
  margin-top: 4px;
}

/* ===== v3: Main text justification (Main Text pane only) ===== */
#mainPane .paper p{
  text-align: justify;
  text-justify: inter-word;
  hyphens: none; /* keep Safari behaviour consistent */
}
#mainPane .paper li{
  text-align: justify;
  text-justify: inter-word;
  hyphens: none;
  overflow-wrap: anywhere;
}
/* Keep bilingual quote cells readable */
#mainPane .paper p.quote{ text-align:left; }

/* Keep lists inside the main text column */
#mainPane .paper ul,
#mainPane .paper ol{
  box-sizing: border-box;
  max-width: 100%;
  padding-right: 0;
  margin-right: 0;
}

/* ===== v3: ToC H2 collapse affordance ===== */
.tocBtn.level-1 .tocTitle::before{
  content:"▾";
  display:inline-block;
  width: 1.1em;
  margin-right: 2px;
  color: var(--muted);
}
li.h2Collapsed > .tocBtn.level-1 .tocTitle::before{ content:"▸"; }



/* =========================================================
   VS2 additions: Resources collapse + Glossary highlighting + Index
   ========================================================= */

/* 4-pane → 3-pane mode (hide Resources) */
#app.res-collapsed{
  grid-template-columns:
    var(--tocW) 1fr var(--notesW);
}
#app.res-collapsed #resourcesPane{ display:none !important; }

/* Glossary reference links in main text */
.paper a.glsref{
  background: transparent !important;
  color: inherit;
  padding: 0;                 /* remove the “pill” feel */
  border-radius: 0;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(0,0,0,0.35);
}

.paper a.glsref:hover{
  text-decoration-color: rgba(0,0,0,0.55);
}

/* Keyboard focus: visible but not loud */
.paper a.glsref:focus{ outline: none; }
.paper a.glsref:focus-visible{
  outline: 2px dotted rgba(0,0,0,0.35);
  outline-offset: 2px;
  border-radius: 2px;
}

/* If your JS applies a “recently clicked” class */
.paper a.glsref.glsref-hit{
  text-decoration-color: rgba(0,0,0,0.75);
  text-shadow: 0 0 0.5px rgba(0,0,0,0.25);
}

/* An internal cross-reference within the same pane */
.paper a.xref{
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(0,0,0,0.4);
  text-underline-offset: 0.15em;
}

.paper a.xref:hover{
  text-decoration-color: rgba(0,0,0,0.65);
}


/* Temporary hit effects */
.gls-hit{
  outline: 2px solid rgba(59, 130, 246, 0.55);
  border-radius: 10px;
  padding: 6px;
  margin-left: -6px;
  background: rgba(59, 130, 246, 0.10);
}
.ref-hit-gls{
  outline: 2px solid rgba(59, 130, 246, 0.45);
  border-radius: 6px;
  padding: 0 3px;
  background: rgba(59, 130, 246, 0.10);
}

/* Glossary index box */
.glsIndexWrap{
  border-bottom: 1px solid rgba(0,0,0,0.10);
  padding: 10px 10px 8px 10px;
}
.glsIndexTitle{
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px 0;
}
.glsIndex{
  max-height: 30vh;
  overflow: auto;
  padding-right: 6px;
}
.glsIndex ul{
  list-style: none;
  padding: 0;
  margin: 0;
}
.glsIndex li{
  margin: 0;
  padding: 2px 0;
}
.glsIndex a{
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
}
.glsIndex a:hover{
  text-decoration: underline;
}

#resourcesScroll.index-collapsed #resourcesIndexWrap{
  display:none !important;
}


/* =========================================================
   Glossary back-references (auto-generated)
   ========================================================= */

.gls-backrefs{
  margin-top: 0.5rem;
  font-size: 0.9em;
  line-height: 1.25;
  opacity: 0.9;
}

.gls-backrefs a{
  text-decoration: none;
  padding: 0 0.25em;
  border-radius: 0.25em;
}

.gls-backrefs a:hover{
  text-decoration: underline;
}

/* ---- ToC tool buttons (scoped to Contents pane only) ---- */
#tocPane .tocTools{
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px 6px;
  margin: 0 0 6px 0;
}

#tocPane .tocTools .tocToolBtn{
    flex: 0 1 auto;
appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 0.78em;
  line-height: 1.1;
  padding: 3px 7px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.18);
  background: rgba(255,255,255,0.50);
  color: inherit;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  min-width: 0;
}

#tocPane .tocTools .tocToolBtn:hover{
  background: rgba(255,255,255,0.70);
  border-color: rgba(0,0,0,0.25);
}

#tocPane .tocTools .tocToolBtn:active{
  transform: translateY(1px);
  background: rgba(255,255,255,0.62);
}

#tocPane .tocTools .tocToolBtn:focus{
  outline: none;
}

#tocPane .tocTools .tocToolBtn:focus-visible{
  outline: 2px solid rgba(59,130,246,0.35);
  outline-offset: 2px;
}

/* If your Contents pane has a dark background in some themes, keep the buttons readable. */
@media (prefers-color-scheme: dark){
  #tocPane .tocTools .tocToolBtn{
      flex: 0 1 auto;
border-color: rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.10);
  }
  #tocPane .tocTools .tocToolBtn:hover{
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.30);
  }
}

/* ---------- Utilities (override paragraph defaults inside .paper) ---------- */
#app .paper .center{ text-align: center; }
#app .paper .flush-right{ text-align: right; }
#app .paper .flush-left{ text-indent: 0; }

