:root {
  --bg: #f7f4ef;
  --ink: #1c1916;
  --muted: #5c564e;
  --line: #d9d2c6;
  --accent: #2f4a3a;
  --card: #fffdf9;
  --wm: rgba(28, 25, 22, 0.18);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #efe7d8 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.55;
}
.skip {
  position: absolute; left: -9999px;
}
.skip:focus { left: 1rem; top: 1rem; background: #fff; padding: .5rem; z-index: 20; }

.top, .foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 1rem 1.25rem; max-width: 960px; margin: 0 auto;
}
.top a, .foot a { color: var(--ink); text-decoration: none; }
.brand { font-weight: 700; letter-spacing: .02em; font-size: 1.15rem; }
.brand-cluster { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.free-copy-cta {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 8px 12px; border: 1px solid #176c70; border-radius: 3px;
  background: rgba(23,108,112,.08); text-decoration: none !important; line-height: 1.2;
}
.free-copy-cta:hover { background: rgba(23,108,112,.14); }
.free-copy-cta-title { font-size: .8125rem; font-weight: 700; color: #176c70; }
.free-copy-cta-sub { font-size: .72rem; color: var(--muted); }
.top nav { display: flex; gap: 1rem; font-size: .95rem; }
.foot { color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); margin-top: 3rem; }

.panel {
  max-width: 680px; margin: 2rem auto; padding: 2rem 1.5rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
}
.panel.narrow { max-width: 480px; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .08em; font-size: .75rem;
  color: var(--muted); margin: 0 0 .75rem;
}
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.8rem, 4vw, 2.4rem); line-height: 1.2; margin: 0 0 1rem; }
.lead { color: var(--muted); font-size: 1.05rem; }
.counter {
  margin: 1.5rem 0; padding: .85rem 1rem; background: #f0ebe2;
  border-left: 3px solid var(--accent); font-size: 1.05rem;
}
.form { display: grid; gap: 1rem; margin: 1.5rem 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
label { display: grid; gap: .35rem; font-size: .95rem; }
input {
  font: inherit; padding: .7rem .8rem; border: 1px solid var(--line);
  border-radius: 3px; background: #fff;
}
.button {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none;
  background: var(--accent); color: #fff; padding: .75rem 1.1rem;
  border-radius: 3px; font: inherit; text-align: center;
}
.button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.hint, .muted { color: var(--muted); font-size: .92rem; }
.msg { margin-top: 1rem; padding: .8rem 1rem; border-radius: 3px; }
.msg.ok { background: #e7f2ea; color: #214432; }
.msg.err, .err { background: #f8e8e6; color: #6b2a22; padding: .8rem 1rem; }
.ok { color: #214432; }
.waitlist-note {
  margin-top: 1.75rem; padding: 1.1rem 1rem;
  border: 1px solid var(--line); border-radius: 3px; background: #f0ebe2;
}
.waitlist-note p { margin: 0 0 .85rem; color: var(--muted); font-size: .95rem; }
.waitlist-note .hint { margin: .85rem 0 0; font-size: .85rem; }
.waitlist-note .button { width: 100%; }

/* Reader */
.reader-body {
  background: #faf7f2;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.reader-body ::selection { background: transparent; }

.watermark {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  overflow: hidden;
}
.watermark .tile {
  position: absolute; white-space: pre; color: var(--wm);
  font-size: clamp(15px, 1.85vw, 20px); font-weight: 700;
  letter-spacing: .03em; line-height: 1.4;
  transform: rotate(-28deg); transform-origin: center;
}

.reader-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .7rem 1rem;
  background: rgba(250, 247, 242, .94); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.reader-meta { display: grid; gap: .1rem; font-size: .85rem; text-align: center; }
.reader-meta strong { font-family: var(--serif); font-size: 1rem; }
.reader-actions { display: flex; gap: .5rem; }
.ghost {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: .4rem .7rem; border-radius: 3px; font: inherit; cursor: pointer;
  text-decoration: none;
}

.toc {
  position: fixed; top: 52px; left: 0; bottom: 0; width: min(320px, 90vw);
  z-index: 6; background: #fffdf9; border-right: 1px solid var(--line);
  padding: 1rem; overflow: auto;
}
.toc h2 { margin: 0 0 .75rem; font-family: var(--serif); font-size: 1.2rem; }
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc li { margin: .35rem 0; }
.toc a { color: var(--ink); text-decoration: none; font-size: .92rem; }
.toc a:hover { text-decoration: underline; }

.reader-main {
  position: relative; z-index: 2;
  max-width: 42rem; margin: 0 auto; padding: 2rem 1.25rem 4rem;
}
.chapter {
  font-family: var(--serif); font-size: 1.12rem; line-height: 1.7;
  color: var(--ink);
}
.chapter h1, .chapter h2, .chapter h3 {
  font-weight: 600; line-height: 1.25; margin: 1.6rem 0 .8rem;
}
.chapter p { margin: 0 0 1rem; }
.chapter .wm-inline {
  color: rgba(28,25,22,.42); font-size: .82rem; letter-spacing: .03em;
  text-align: center; margin: 1.5rem 0; font-family: var(--sans);
  font-weight: 600;
}
.chapter-nav {
  display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem;
}
.loading { color: var(--muted); }

@media (max-width: 640px) {
  .reader-meta span { display: none; }
  .panel { margin: 1rem; padding: 1.4rem 1.1rem; }
}
