body {
    margin: 0;
    font-family: "Arial", sans-serif;
    background: linear-gradient(135deg, #1d1d1d 0%, #3a2a1e 100%);
    color: #f2e7d5;
    padding: 1em;
    min-height: 100vh;
}

/* Responsive media */
img, video, svg, canvas {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
}
figure { margin: 1.25rem auto; }
figcaption { font-size: 0.95rem; opacity: 0.85; text-align: center; }

:root {
  --body-size: clamp(15px, 2.4vw, 18px);
}
body { font-size: var(--body-size); }
h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: #f5d48c;
    letter-spacing: 1px;
}
h2, h4 {
    text-align: center;
}

/* Constrain flow content to the same reading measure */
h1, h2, h3, blockquote, hr {
  max-width: 45em;
  margin-left: auto;
  margin-right: auto;
}

hr { margin: 1.5rem auto; border: 0; border-top: 1px solid rgba(255,255,255,0.15); }

h3 { 
    font-family: "Montserrat", "Segoe UI", "Helvetica Neue", "Open Sans", "Verdana", sans-serif;
    font-size: calc(1rem + (var(--reader-zoom) * 0.8));
    font-weight: 300;
}

p {
    font-size: calc(1.1rem + var(--reader-zoom));
    max-width: 45em;
    margin: 0 auto 2rem;
    line-height: 1.45;
}
/* Lists should follow the same measure and rhythm as paragraphs */
ul, ol {
  max-width: 40em;
  margin: 0 auto 2rem;
  padding-left: 1.25rem; /* keep a readable indent */
}

#appendix ul {
  column-count: 2;
  column-gap: 2rem;
  list-style-position: inside;
}
/* Add 3 columns for larger screens */
@media (min-width: 650px) {
  #appendix ul {
    column-count: 3;
  }
}
#appendix li {
  break-inside: avoid;
  line-height: 1;
  margin-bottom: 0.5rem;
}

li {
  line-height: 1.45;          /* match paragraph leading */
  margin-bottom: 1.1rem;      /* space between list items ~ paragraph line spacing */
}
a.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #f5d48c;
    color: #1d1d1d;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.3s ease;
}
a.button:hover {
    background: #e8c66b;
}

/* Link styling */
a {
  color: #f5d48c; /* warm gold tone matching headings */
  text-decoration: none;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}
a:hover, a:focus {
  color: #fff3d1;
  text-shadow: 0 0 4px rgba(245, 212, 140, 0.5);
}
a:visited {
  color: #d9b96e;
}
a.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #f5d48c;
    color: #1d1d1d;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.3s ease;
}
a.button:hover {
    background: #e8c66b;
}
footer {
    margin-top: 2rem;
    font-size: calc(0.9rem + (var(--reader-zoom) * 0.8));
    opacity: 0.7;
}
.hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
/* ===== Hero background that stays static while content scrolls ===== */
body.hero-bg {
  background: linear-gradient(135deg, #1d1d1d 0%, #3a2a1e 100%);
  background-image: url("../images/cover.png");
  background-position: top center;
  background-size: contain;
  background-repeat: no-repeat;
  background-attachment: fixed; /* keeps image static */
  color: #f4f1ea;
  background-color: #3a2a1e;
  min-height: 100vh;
}
@media (min-width: 665px) and (max-width: 999px) {
  body.hero-bg {
    background-size: cover; /* keep image at 1000px width and show gutters */
  }
}
@media (min-width: 1000px) {
  body.hero-bg {
    background-size: 1000px auto; /* keep image at 1000px width and show gutters */
  }
}
/* Create initial viewport of just the art before words rise */
.hero-spacer {
  height: 70vh; /* adjust to taste (60–80vh works well) */
  width: 100%;
}
/* The panel that "rises" over the art and blurs the background */
.glass-panel {
  position: sticky;
  top: 0;                 /* sticks to the top as you scroll */
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  border-radius: 12px;
  background: rgba(20, 16, 12, 0.35);          /* subtle tint */
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);                   /* blur the art behind */
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.glass-panel h1 {
  margin-top: 0;
}

/* Ensure links/buttons sit nicely on the panel */
.glass-panel .button {
  display: inline-block;
  margin: 0.3rem 0.2rem;
}

/* Extra space so the sticky panel can scroll off */
.after-content {
  height: 120vh; /* gives room for the sticky panel to ride above the image */
}

/* Fallback for browsers without backdrop-filter: darken the panel a bit more */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-panel { background: rgba(20, 16, 12, 0.65); }
}

/* Mobile refinements */
@media (max-width: 520px) {
  body { padding: 0.75rem; }
  .glass-panel { padding: 1rem; }
  p { 
    line-height: 1.45;
    margin: 0 auto 1.5rem;
    max-width: 90vw; /* allow more words across on small screens */
  }
  h1 { font-size: 2rem; }

  ul, ol {
    max-width: 90vw;
    margin: 0 auto 1.5rem;
  }
  li {
    line-height: 1.45;
    margin-bottom: 1rem;
  }
  h1, h2, h3, blockquote, hr { max-width: 90vw; }
}

/* ===== Reader Controls Footer ===== */
:root {
  --body-size: clamp(15px, 2.4vw, 18px);
}
:root {
  --reader-zoom: 0px;
  --footer-height: 56px;
}

body {
  font-size: calc(var(--body-size) + var(--reader-zoom));
  padding-bottom: calc(var(--footer-height) + 1rem);
}

body.theme-light {
  background: #ffffff;
  color: #111;
}
body.theme-light .glass-panel { 
  background: rgba(255,255,255,0.65);
  color: #111;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.theme-light .glass-panel { background: rgba(255,255,255,0.85); }
}
body.theme-light a { color: #1a4fb5; }
body.theme-light a:hover, body.theme-light a:focus { color: #123a87; text-shadow: none; }
body.theme-light a:visited { color: #5b3fad; }
body.theme-light hr { border-top-color: rgba(0,0,0,0.15); }

.reader-footer {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: 0 .75rem;
  background: rgba(20,16,12,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid rgba(255,255,255,0.12);
  z-index: 1000;
}
.reader-footer .controls {
  display: flex;
  gap: .5rem;
  align-items: center;
}
.reader-footer .spacer { flex: 1; }
.reader-footer button {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: #f2e7d5;
  padding: .4rem .65rem;
  border-radius: 6px;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
}
.reader-footer button:hover { background: rgba(255,255,255,0.15); }
body.theme-light .reader-footer {
  background: rgba(255,255,255,0.8);
  border-top-color: rgba(0,0,0,0.12);
}
body.theme-light .reader-footer button {
  border-color: rgba(0,0,0,0.2);
  background: rgba(0,0,0,0.05);
  color: #111;
}

@media (max-width: 520px) {
  :root { --footer-height: 52px; }
  body { padding-bottom: calc(var(--footer-height) + .75rem); }
  .reader-footer { padding: 0 .5rem; }
  .reader-footer button { font-size: .9rem; padding: .35rem .55rem; }
}
.js-ch-title {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;           /* this is key */
  text-align: left;         /* keeps visual alignment normal */
}