/* The Consolation of Philosophy — Book I reader
   Manuscript-inspired, two-panel (text | commentary) layout. */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&family=Spectral:wght@300;400;500&display=swap');

:root {
  --ink:        #2b2520;
  --ink-soft:   #5a5048;
  --parchment:  #f5efe2;
  --parchment-2:#efe7d4;
  --panel:      #fbf7ed;
  --rule:       #d8ccb2;
  --accent:     #7c2d2d;   /* rubric red */
  --accent-2:   #355e6b;   /* teal for commentary */
  --gold:       #a07d33;
  --shadow:     rgba(60, 45, 25, 0.12);
  --maxw:       1280px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 10%, #faf5ea 0%, transparent 45%),
    radial-gradient(circle at 85% 90%, #efe6d2 0%, transparent 50%),
    var(--parchment);
  color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.4rem;
  background: rgba(245, 239, 226, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar .brand {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
  color: var(--ink);
}
.topbar .brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 1rem; font-size: 0.95rem; }
.topbar nav a { color: var(--ink-soft); }

/* ---------- Page shell ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.4rem; }

/* ---------- Chapter header ---------- */
.chapter-head {
  text-align: center;
  padding: 3.2rem 1rem 1.6rem;
  max-width: 760px; margin: 0 auto;
}
.chapter-head .book-label {
  font-family: 'Cormorant Garamond', serif;
  text-transform: uppercase; letter-spacing: 0.35em;
  font-size: 0.8rem; color: var(--accent);
}
.chapter-head h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.1;
  margin: 0.5rem 0 0.3rem;
}
.chapter-head .subtitle {
  font-style: italic; color: var(--ink-soft);
  font-size: 1.1rem;
}
.chapter-head .ornament {
  margin: 1.2rem auto 0; width: 120px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  position: relative;
}
.chapter-head .ornament::after {
  content: '❧'; position: absolute; top: -0.75rem; left: 50%;
  transform: translateX(-50%); color: var(--gold);
  background: var(--parchment); padding: 0 0.5rem; font-size: 0.9rem;
}

/* ---------- Two-panel layout ---------- */
.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.4rem;
  padding: 1.5rem 0 4rem;
  align-items: start;
}
.panel-label {
  font-family: 'Cormorant Garamond', serif;
  text-transform: uppercase; letter-spacing: 0.22em;
  font-size: 0.78rem; font-weight: 600;
  padding-bottom: 0.5rem; margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--rule);
}
.col-text .panel-label  { color: var(--accent); }
.col-note .panel-label  { color: var(--accent-2); }

.col-note {
  position: sticky; top: 64px;
}

/* ---------- Text column ---------- */
.col-text .prose { text-align: justify; hyphens: auto; }
.col-text .prose p { margin: 0 0 1.1rem; }

.col-text .prose.lead > p:first-of-type::first-letter {
  font-family: 'Cormorant Garamond', serif;
  float: left; font-size: 3.6rem; line-height: 0.78;
  padding: 0.2rem 0.6rem 0 0; color: var(--accent);
  font-weight: 600;
}

/* Song / verse block */
.song {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: 3px;
  padding: 1.4rem 1.6rem;
  margin: 0 0 1.8rem;
  box-shadow: 0 2px 10px var(--shadow);
}
.song .song-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600; font-size: 1.15rem; color: var(--accent);
  margin: 0 0 0.1rem;
}
.song .song-title small {
  display: block; font-family: 'EB Garamond', serif;
  font-style: italic; font-weight: 400; font-size: 0.95rem;
  color: var(--ink-soft); letter-spacing: 0;
}
.song .verse {
  font-family: 'Spectral', serif;
  font-weight: 300;
  font-size: 1.02rem;
  line-height: 1.5;
  margin: 1rem 0 0;
  white-space: pre-line;
}
.song .verse.stanza { margin-top: 1rem; }

.section-marker {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600; letter-spacing: 0.1em;
  color: var(--accent); text-transform: uppercase;
  font-size: 0.85rem;
  margin: 2rem 0 0.6rem;
}

/* footnote references / inline */
.fn { vertical-align: super; font-size: 0.7em; color: var(--accent); cursor: help; }
.footnotes {
  margin-top: 2rem; padding-top: 1rem; border-top: 1px dotted var(--rule);
  font-size: 0.86rem; color: var(--ink-soft);
}
.footnotes p { margin: 0.4rem 0; }
.footnotes .fn-id { color: var(--accent); font-weight: 600; }

/* ---------- Commentary column ---------- */
.note-card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.3rem 1.5rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 2px 8px var(--shadow);
}
.note-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem; font-weight: 600;
  margin: 0 0 0.6rem; color: var(--accent-2);
  display: flex; align-items: center; gap: 0.5rem;
}
.note-card h3 .ic { font-size: 1.1rem; }
.note-card p { margin: 0 0 0.8rem; font-size: 0.98rem; }
.note-card p:last-child { margin-bottom: 0; }
.note-card.theme { border-left: 3px solid var(--accent-2); }
.note-card.context { border-left: 3px solid var(--gold); }
.note-card.glossary { border-left: 3px solid var(--accent); }

.note-card .quote {
  font-style: italic; color: var(--ink-soft);
  border-left: 2px solid var(--rule); padding-left: 0.8rem; margin: 0.6rem 0 0.9rem;
  font-size: 0.95rem;
}
dl.gloss { margin: 0; }
dl.gloss dt { font-weight: 600; color: var(--ink); margin-top: 0.6rem; }
dl.gloss dt:first-child { margin-top: 0; }
dl.gloss dd { margin: 0.1rem 0 0; font-size: 0.94rem; color: var(--ink-soft); }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
.tag {
  font-size: 0.78rem; letter-spacing: 0.03em;
  background: var(--parchment-2); color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: 20px;
  padding: 0.15rem 0.7rem;
}

/* ---------- Chapter nav ---------- */
.chap-nav {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 2rem 0 4rem; border-top: 1px solid var(--rule);
}
.chap-nav a {
  flex: 1; max-width: 46%;
  background: var(--panel); border: 1px solid var(--rule);
  border-radius: 6px; padding: 0.9rem 1.2rem;
  color: var(--ink); transition: transform .15s, box-shadow .15s;
}
.chap-nav a:hover { transform: translateY(-2px); box-shadow: 0 4px 14px var(--shadow); text-decoration: none; }
.chap-nav a.next { text-align: right; }
.chap-nav .dir {
  font-family: 'Cormorant Garamond', serif; text-transform: uppercase;
  letter-spacing: 0.18em; font-size: 0.72rem; color: var(--accent);
}
.chap-nav .ttl { display: block; font-size: 1.05rem; margin-top: 0.15rem; }
.chap-nav .spacer { flex: 1; max-width: 46%; }

/* ---------- Index page ---------- */
.hero {
  text-align: center; padding: 4.5rem 1.2rem 2rem; max-width: 820px; margin: 0 auto;
}
.hero .book-label {
  font-family: 'Cormorant Garamond', serif; text-transform: uppercase;
  letter-spacing: 0.4em; font-size: 0.85rem; color: var(--accent);
}
.hero h1 {
  font-family: 'Cormorant Garamond', serif; font-weight: 600;
  font-size: clamp(2.4rem, 7vw, 4.2rem); line-height: 1.05; margin: 0.6rem 0 0.2rem;
}
.hero h1 em { color: var(--accent); font-style: italic; }
.hero .byline { font-style: italic; color: var(--ink-soft); font-size: 1.15rem; }
.hero .blurb { margin: 1.6rem auto 0; max-width: 640px; font-size: 1.08rem; }
.hero .epigraph {
  font-style: italic; color: var(--ink-soft); margin-top: 1.6rem;
  font-size: 1rem; line-height: 1.5;
}

.toc {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1.2rem; padding: 1.5rem 0 4rem;
}
.toc-card {
  display: block; background: var(--panel); border: 1px solid var(--rule);
  border-radius: 8px; padding: 1.4rem 1.5rem; color: var(--ink);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  position: relative; overflow: hidden;
}
.toc-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px var(--shadow); border-color: var(--gold); text-decoration: none; }
.toc-card .num {
  font-family: 'Cormorant Garamond', serif; font-size: 2.4rem; font-weight: 600;
  color: var(--gold); line-height: 1; opacity: 0.55;
}
.toc-card h2 {
  font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 1.4rem;
  margin: 0.3rem 0 0.4rem; color: var(--accent);
}
.toc-card p { margin: 0; font-size: 0.96rem; color: var(--ink-soft); }
.toc-card .song-tag {
  margin-top: 0.8rem; font-size: 0.8rem; font-style: italic; color: var(--ink-soft);
}

.summary-block {
  background: var(--panel); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 1.6rem 1.8rem; margin: 1rem 0 2rem;
}
.summary-block h2 {
  font-family: 'Cormorant Garamond', serif; color: var(--accent);
  margin: 0 0 0.6rem; font-size: 1.5rem;
}

footer.site {
  text-align: center; padding: 2.5rem 1rem 3rem; color: var(--ink-soft);
  font-size: 0.85rem; border-top: 1px solid var(--rule);
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  body { font-size: 18px; }
  .panels { grid-template-columns: 1fr; gap: 1.4rem; }
  .col-note { position: static; }
  .col-note { margin-top: 1rem; }
  .topbar nav { display: none; }
}
