/* ─────────────────────────────────────────────────────────────
 *  Nous — Site chrome
 *  Top nav, chapter prev/next, footer, theme toggle.
 *  Loaded on every HTML page (index, chapters, colophon).
 *
 *  All colors and spacing from tokens.css.
 *  "Almost nothing" is the brief — hairlines, small-caps, no filled
 *  shapes or drop shadows. The chrome must recede.
 * ───────────────────────────────────────────────────────────── */


/* ══ Top navigation ═════════════════════════════════════════ */

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
  padding: var(--s-4) var(--s-7);
  border-bottom: 1px solid var(--nous-rule);
  background: var(--nous-paper);
  transition:
    background var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out);
}

.site-nav__brand {
  font-family: var(--ff-greek);
  font-style: italic;
  font-size: var(--fs-lg);
  color: var(--nous-ink);
  text-decoration: none;
  letter-spacing: 0;
  line-height: 1;
  transition: color var(--dur-fast) var(--ease-out);
}
.site-nav__brand:hover { color: var(--nous-terracotta); }

.site-nav__chapters {
  display: flex;
  gap: var(--s-5);
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.site-nav__chapters a,
.site-nav__chapters span {
  font-family: var(--ff-sc);
  font-size: var(--fs-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--nous-ink-3);
  text-decoration: none;
  padding: var(--s-2) 0;
  position: relative;
  font-variant-numeric: oldstyle-nums;
  transition: color var(--dur-fast) var(--ease-out);
}
.site-nav__chapters a:hover { color: var(--nous-ink); }

/* Current chapter gets a terracotta dot above the numeral */
.site-nav__chapters a[aria-current="page"],
.site-nav__chapters span[aria-current="page"] {
  color: var(--nous-terracotta);
}
.site-nav__chapters a[aria-current="page"]::before,
.site-nav__chapters span[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--nous-terracotta);
  border-radius: 50%;
}

/* Placeholder/future chapters — dim, not clickable */
.site-nav__chapters a[aria-disabled="true"],
.site-nav__chapters span[aria-disabled="true"] {
  color: var(--nous-ink-4);
  opacity: 0.5;
  pointer-events: none;
  cursor: default;
}

/* Theme toggle — two pinhead-sized circles */
.site-nav__theme {
  display: inline-flex;
  gap: var(--s-3);
  align-items: center;
}
.site-nav__theme button {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  font-family: var(--ff-sc);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--nous-ink-4);
  line-height: 1;
  transition: color var(--dur-fast) var(--ease-out);
}
.site-nav__theme button::before {
  content: "";
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 50%;
  transition: background var(--dur-fast) var(--ease-out);
}
.site-nav__theme [data-theme="dark"]::before { background: currentColor; }
.site-nav__theme button:hover { color: var(--nous-ink); }
[data-mode="light"] .site-nav__theme [data-theme="light"],
[data-mode="dark"]  .site-nav__theme [data-theme="dark"] {
  color: var(--nous-terracotta);
}


/* ══ Chapter container ══════════════════════════════════════ */

.chapter {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s-9) var(--s-7) var(--s-10);
  position: relative;
}

.chapter__folio {
  font-family: var(--ff-sc);
  font-size: var(--fs-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--nous-ink-4);
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--s-8);
}
.chapter__folio .num { font-variant-numeric: oldstyle-nums; }


/* ══ Chapter prev/next ═════════════════════════════════════ */

.chapter-nav {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s-7) var(--s-7) var(--s-8);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-6);
  border-top: 1px solid var(--nous-rule-soft);
}
.chapter-nav a {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  color: var(--nous-ink);
  text-decoration: none;
  max-width: 42%;
  transition: color var(--dur-fast) var(--ease-out);
}
.chapter-nav a:hover .chapter-nav__title {
  color: var(--nous-terracotta);
}
.chapter-nav__label {
  font-family: var(--ff-sc);
  font-size: var(--fs-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--nous-ink-4);
}
.chapter-nav__title {
  font-family: var(--ff-display);
  font-style: italic;
  font-size: var(--fs-md);
  line-height: 1.3;
  color: var(--nous-ink);
  transition: color var(--dur-fast) var(--ease-out);
}
.chapter-nav__next {
  align-items: flex-end;
  text-align: right;
}

/* Disabled placeholders for not-yet-built chapters */
.chapter-nav [aria-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}


/* ══ Footer ═════════════════════════════════════════════════ */

.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s-5) var(--s-7) var(--s-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-5);
  border-top: 1px solid var(--nous-rule-soft);
  font-family: var(--ff-sc);
  font-size: var(--fs-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--nous-ink-4);
}
.site-footer a {
  color: var(--nous-ink-3);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
.site-footer a:hover { color: var(--nous-terracotta); }


/* ══ Responsive ═════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .site-nav { padding: var(--s-3) var(--s-5); }
  .site-nav__chapters { gap: var(--s-4); }
  .chapter { padding: var(--s-7) var(--s-5) var(--s-8); }
  .chapter-nav { padding: var(--s-6) var(--s-5); }
  .site-footer { padding: var(--s-5); }
}

@media (max-width: 640px) {
  .site-nav {
    flex-wrap: wrap;
    row-gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
  }
  /* On phone, chapter numerals collapse — brand + theme toggle only.
     Tap brand to reach index; index page has the chapter list. */
  .site-nav__chapters { display: none; }

  .chapter { padding: var(--s-5) var(--s-4) var(--s-7); }

  .chapter-nav {
    flex-direction: column;
    gap: var(--s-5);
    padding: var(--s-5) var(--s-4);
  }
  .chapter-nav a { max-width: none; }
  .chapter-nav__next { align-items: flex-start; text-align: left; }

  .site-footer {
    flex-direction: column;
    gap: var(--s-3);
    text-align: center;
    padding: var(--s-5) var(--s-4);
  }
}


/* ══ Print ══════════════════════════════════════════════════ */

@media print {
  .site-nav,
  .chapter-nav,
  .site-footer { display: none; }

  .chapter {
    max-width: none;
    padding: 0;
  }

  /* Ensure backgrounds and decoration print (not always default) */
  body { background: white; }
  .chapter h1, .chapter h2, .chapter h3 {
    break-after: avoid-page;
  }
  p, blockquote { orphans: 3; widows: 3; }
}
