/* THE COUNTERWEIGHT — literary reading site
   dark-on-cream, neon-red accent echoing the OPEN sign motif. */

:root {
  --cream: #f3ead7;
  --cream-2: #ece0c8;
  --paper: #f8f2e4;
  --ink: #1c1714;
  --ink-soft: #3a322c;
  --muted: #6b6055;
  --rule: #d6c8ac;
  --red: #ff2d2d;
  --red-deep: #c61f1f;
  --red-glow: rgba(255, 45, 45, 0.55);
  --amber: #d98a2b;
  --measure: 62ch;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ---------------------------------------------------------- top nav */

.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 2.4rem);
  background: rgba(28, 23, 20, 0.96);
  border-bottom: 1px solid #000;
  font-family: var(--sans);
}
.topnav .brand {
  color: var(--cream);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 0.86rem;
  text-transform: uppercase;
}
.topnav .brand:hover { color: var(--red); text-decoration: none; }
.topnav-links { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.topnav-links a {
  color: var(--cream-2);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.topnav-links a:hover { color: var(--red); text-decoration: none; }
.topnav-links a[aria-current="page"] { color: var(--red); }

/* -------------------------------------------------------- OPEN sign */

@keyframes neon {
  0%, 92%, 100% {
    color: var(--red);
    text-shadow: 0 0 4px var(--red-glow), 0 0 14px var(--red-glow),
      0 0 28px rgba(255, 45, 45, 0.35);
  }
  94%, 96% { color: #5a1414; text-shadow: none; }
}
.open-sign {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 800;
  letter-spacing: 0.42em;
  font-size: clamp(1.1rem, 3vw, 1.7rem);
  padding: 0.45em 0.2em 0.45em 0.6em;
  border: 2px solid var(--red);
  border-radius: 4px;
  color: var(--red);
  animation: neon 4.5s infinite;
  margin-bottom: 1.4rem;
}
.open-sign.small {
  font-size: 0.95rem;
  letter-spacing: 0.36em;
  border-width: 1.5px;
}

/* ------------------------------------------------------------- hero */

.hero {
  max-width: 56rem;
  margin: 0 auto;
  padding: clamp(2.6rem, 7vw, 5rem) clamp(1.2rem, 5vw, 2rem) 2rem;
  text-align: center;
}
.hero-title {
  font-size: clamp(2.6rem, 9vw, 5rem);
  line-height: 1.02;
  letter-spacing: 0.02em;
  margin: 0.2em 0 0.1em;
  font-weight: 700;
}
.hero-sub {
  font-style: italic;
  color: var(--muted);
  font-size: 1.2rem;
  margin: 0 0 1.4rem;
}
.hero-tagline {
  font-size: clamp(1.2rem, 3.4vw, 1.5rem);
  max-width: 40ch;
  margin: 0 auto 2rem;
  color: var(--ink-soft);
  font-style: italic;
}
.hero-cta {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.free-note {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 1.2rem;
}

/* ----------------------------------------------------------- buttons */

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.7em 1.5em;
  border-radius: 2px;
  border: 1.5px solid var(--red-deep);
  transition: all 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--red-deep);
  color: var(--cream);
  box-shadow: 0 0 0 0 var(--red-glow);
}
.btn-primary:hover {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 18px var(--red-glow);
}
.btn-ghost { background: transparent; color: var(--red-deep); }
.btn-ghost:hover { background: rgba(255, 45, 45, 0.08); color: var(--red); }

/* ----------------------------------------------------- home sections */

main.home {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem clamp(1.2rem, 5vw, 2rem) 4rem;
}
.home section { margin-top: 3.2rem; }
.home h2 {
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
  margin-bottom: 1.4rem;
}
.blurb p { margin: 0 0 1.1rem; }

.epigraph {
  margin: 0 0 2rem;
  padding: 0;
  border: none;
  font-style: italic;
  font-size: 1.28rem;
  line-height: 1.55;
  color: var(--red-deep);
  text-align: center;
}
.epigraph::before { content: "“"; }
.epigraph::after { content: "”"; }

.comps ul { list-style: none; padding: 0; margin: 0; }
.comps li {
  padding: 0.5rem 0 0.5rem 1.4rem;
  position: relative;
  font-style: italic;
  color: var(--ink-soft);
}
.comps li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--red);
}

/* ----------------------------------------------------- contents lists */

.toc-note, .toc-foot { font-style: italic; color: var(--muted); }
.toc-foot { margin-top: 2rem; font-style: normal; }

ol.toc-list, .home .toc-list { list-style: none; padding: 0; margin: 0; counter-reset: none; }
.toc-list li { border-bottom: 1px dotted var(--rule); }
.toc-list li:last-child { border-bottom: none; }
.toc-list a {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.65rem 0.2rem;
  color: var(--ink);
}
.toc-list a:hover { color: var(--red-deep); text-decoration: none; background: rgba(255,45,45,0.04); }
.toc-list .num {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--red-deep);
  font-weight: 700;
  min-width: 1.8rem;
}
.toc-list .ttl { flex: 1; }
.toc-list .pov {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* contents page */
.contents-page, .chapter-page, main.manuscript {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.4rem clamp(1.2rem, 6vw, 2.2rem) 4rem;
}
.page-head { margin-bottom: 2.4rem; text-align: center; }
.page-head h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0 0 0.4rem; }
.page-sub { color: var(--muted); font-style: italic; }
.book-group { margin: 2.6rem 0; }
.book-head {
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red-deep);
  border-bottom: 2px solid var(--rule);
  padding-bottom: 0.5rem;
}
.book-pov {
  font-style: italic;
  color: var(--muted);
  margin: 0.4rem 0 1rem;
  font-size: 0.95rem;
}

/* ------------------------------------------------------------- prose */

.prose {
  font-size: 1.2rem;
  line-height: 1.78;
  color: var(--ink-soft);
  hyphens: auto;
}
.prose p { margin: 0 0 1.25rem; }
/* drop-cap on first paragraph */
.prose > p:first-of-type::first-letter {
  font-size: 3.2em;
  line-height: 0.8;
  float: left;
  padding: 0.05em 0.08em 0 0;
  color: var(--red-deep);
  font-weight: 600;
}
.prose em { font-style: italic; }
.prose strong { font-weight: 700; color: var(--ink); }

.anchor {
  margin: 0 0 2rem;
  padding: 0.9rem 1.2rem;
  border-left: 3px solid var(--red);
  background: rgba(0, 0, 0, 0.025);
  font-style: italic;
  font-size: 0.98rem;
  color: var(--muted);
  font-family: var(--sans);
  letter-spacing: 0.01em;
}

.scene-break {
  border: none;
  text-align: center;
  margin: 2.4rem 0;
}
.scene-break::before {
  content: "✦ ✦ ✦";
  letter-spacing: 0.8em;
  color: var(--rule);
  font-size: 0.8rem;
}

.the-end {
  text-align: center;
  font-family: var(--sans);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--red-deep);
  margin: 3rem 0 1rem;
  font-size: 0.9rem;
}

/* ------------------------------------------------ chapter page heads */

.chapter-head { margin-bottom: 2.2rem; text-align: center; }
.chapter-eyebrow {
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.chapter-title {
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  line-height: 1.15;
  margin: 0;
  font-weight: 600;
}
.chapter-num {
  display: block;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red-deep);
  margin-bottom: 0.4rem;
}

/* chapter nav */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.6rem;
  align-items: center;
  margin-top: 3.4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.85rem;
}
.chapter-nav a { display: inline-block; }
.chapter-nav .nav-prev { text-align: left; }
.chapter-nav .nav-next { text-align: right; }
.chapter-nav .nav-full {
  text-align: center;
  border: 1px solid var(--red-deep);
  padding: 0.4em 0.9em;
  border-radius: 2px;
  white-space: nowrap;
}
.chapter-nav .nav-full:hover { background: var(--red-deep); color: var(--cream); text-decoration: none; }
.chapter-nav span { display: block; color: var(--muted); font-style: italic; font-size: 0.8rem; }
.chapter-nav .disabled { opacity: 0.6; }

/* --------------------------------------------------- manuscript page */

.reader-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.6rem clamp(1rem, 5vw, 2rem);
  background: rgba(243, 234, 215, 0.97);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(6px);
  font-family: var(--sans);
}
/* offset so reader-bar sits under the topnav */
.topnav + #top + .reader-bar,
.reader-bar { top: 0; }
.reader-title { font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; }
.reader-sub { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.jump { font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 0.5rem; }
.jump select {
  font-family: var(--sans);
  font-size: 0.8rem;
  padding: 0.3em 0.5em;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  border-radius: 2px;
  max-width: 60vw;
}

.manuscript-hero { text-align: center; margin-bottom: 3rem; }
.manuscript-hero h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); margin: 0.2em 0 0; }

.book-divider {
  text-align: center;
  margin: 4.5rem 0 2.5rem;
  position: relative;
}
.book-divider::before {
  content: "";
  display: block;
  border-top: 1px solid var(--rule);
  margin-bottom: -0.8em;
}
.book-divider span {
  display: inline-block;
  background: var(--cream);
  padding: 0 1.4rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red-deep);
  font-weight: 700;
}

.chapter { scroll-margin-top: 5rem; padding-top: 1.5rem; }
.chapter + .chapter { border-top: 1px dotted var(--rule); }
.manuscript .chapter-head { margin-top: 1rem; }
.back-top {
  text-align: center;
  margin-top: 2.4rem;
  font-family: var(--sans);
  font-size: 0.78rem;
}
.back-top a { color: var(--muted); }

/* ----------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--cream-2);
  padding: 2.4rem clamp(1.2rem, 5vw, 2rem);
  text-align: center;
}
.site-footer .free {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
  max-width: 50ch;
  margin: 0 auto 0.8rem;
}
.open-tag {
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--red);
  text-shadow: 0 0 8px var(--red-glow);
  margin-right: 0.4em;
}
.site-footer .fine {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  max-width: 56ch;
  margin: 0 auto;
}

/* ---------------------------------------------------------- responsive */

@media (max-width: 640px) {
  body { font-size: 1.08rem; }
  .prose { font-size: 1.1rem; }
  .topnav { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .chapter-nav { grid-template-columns: 1fr; text-align: center; }
  .chapter-nav .nav-prev, .chapter-nav .nav-next { text-align: center; }
  .prose > p:first-of-type::first-letter { font-size: 2.6em; }
}

/* ------------------------------------------------------------- print */

@media print {
  .topnav, .reader-bar, .chapter-nav, .back-top, .hero-cta,
  .jump, .open-sign, .site-footer .free { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  a { color: #000; text-decoration: none; }
  .prose { color: #000; }
  .anchor { background: none; border-left: 2px solid #000; color: #333; }
  .chapter { page-break-before: always; }
  .book-divider span { background: #fff; }
}
