@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700;9..144,900&family=Work+Sans:wght@400;500;600&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #211d1a;
  --paper: #faf5ec;
  --paper-raised: #fffdf9;
  --accent: #9c3d2e;
  --accent-dark: #732c21;
  --gold: #b1872f;
  --muted: #847c70;
  --line: #e3d9c6;
  --success: #2d7a4f;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Work Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  animation: fadeIn 0.4s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wrap { max-width: 900px; margin: 0 auto; padding: 0 28px 100px; }
.wrap-sm { max-width: 720px; margin: 0 auto; padding: 0 28px 100px; }

/* ── Topbar ───────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-raised);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.brand .mark { font-family: 'Fraunces', serif; font-weight: 900; font-size: 22px; color: var(--accent); }
.brand .name { font-size: 12px; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; font-weight: 600; }

.auth-area { display: flex; align-items: center; gap: 12px; }
#status { font-size: 12px; color: var(--muted); }
#status strong { color: var(--ink); }

button {
  padding: 9px 20px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Work Sans', sans-serif;
  font-weight: 500;
  transition: all 0.15s ease;
}
#google-btn { background: var(--accent); color: #fff8ef; box-shadow: 0 2px 0 var(--accent-dark); }
#google-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 0 var(--accent-dark); }
#signout-btn { background: transparent; color: var(--muted); border: 1px solid var(--line); }
#signout-btn:hover { background: var(--line); }

/* ── Home hero ────────────────────────────────────────── */
.home-hero {
  text-align: center;
  padding: 70px 0 50px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 16px;
}
.home-hero h1 {
  font-family: 'Fraunces', serif;
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  line-height: 1.1;
}
.home-hero p { font-size: 16px; color: var(--muted); max-width: 420px; margin: 0 auto; line-height: 1.6; }

/* ── Member cards grid ────────────────────────────────── */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.member-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.member-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  opacity: 0;
  transition: opacity 0.2s ease;
}
.member-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(33,29,26,0.1); border-color: var(--gold); }
.member-card:hover::before { opacity: 1; }

.member-card.coming-soon {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
.member-card.coming-soon:hover { transform: none; box-shadow: none; }

.card-initials {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 18px;
  color: #fff8ef;
}
.coming-soon .card-initials {
  background: var(--line);
  color: var(--muted);
}

.card-name { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; line-height: 1.2; }
.card-desc { font-size: 13px; color: var(--muted); }

.card-chapters { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }

.coming-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  margin-top: 4px;
}

/* ── Progress bar ─────────────────────────────────────── */
.progress-wrap { margin-top: 4px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.progress-label strong { color: var(--success); }
.progress-track {
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), #4caf80);
  border-radius: 999px;
  transition: width 0.6s ease;
}

.card-arrow {
  font-size: 18px;
  color: var(--gold);
  margin-top: auto;
  transition: transform 0.2s ease;
}
.member-card:hover .card-arrow { transform: translateX(4px); }

/* ── Chapter page hero ───────────────────────────────── */
.chapter-hero {
  text-align: center;
  padding: 56px 0 36px;
}
.chapter-num {
  font-family: 'Fraunces', serif;
  font-size: 80px;
  line-height: 1;
  font-weight: 300;
  color: var(--line);
  margin-bottom: 4px;
}
.chapter-hero h2 {
  font-family: 'Fraunces', serif;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  line-height: 1.2;
}
.rule { width: 48px; height: 2px; background: var(--gold); margin: 0 auto; border: none; }

/* ── Member index (chapter list) ─────────────────────── */
.member-index-hero { text-align: center; padding: 60px 0 40px; }
.member-index-hero h1 { font-family: 'Fraunces', serif; font-size: 40px; font-weight: 700; margin-bottom: 10px; }
.member-index-hero p { color: var(--muted); font-size: 15px; }

.chapter-list { margin-top: 32px; padding: 0; list-style: none; }
.chapter-list li { border-top: 1px solid var(--line); }
.chapter-list li:last-child { border-bottom: 1px solid var(--line); }
.chapter-list a {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 6px; text-decoration: none; color: var(--ink);
  transition: padding-left 0.18s ease, color 0.18s ease;
}
.chapter-list a:hover { padding-left: 14px; color: var(--accent); }
.chapter-list .num { font-family: 'Fraunces', serif; font-size: 14px; color: var(--gold); font-weight: 600; min-width: 26px; }
.chapter-list .ch-title { font-size: 17px; font-family: 'Fraunces', serif; font-weight: 500; flex: 1; }
.chapter-list .read-badge {
  font-size: 11px; font-weight: 600; color: var(--success);
  background: rgba(45,122,79,0.1); padding: 3px 10px; border-radius: 999px;
  white-space: nowrap;
}
.chapter-list .arrow { opacity: 0; transition: opacity 0.18s, transform 0.18s; color: var(--accent); transform: translateX(-4px); }
.chapter-list a:hover .arrow { opacity: 1; transform: translateX(0); }

/* ── Prose ───────────────────────────────────────────── */
.prose { margin-top: 8px; }
.prose p { font-size: 17px; margin: 0 0 22px; color: #3a342d; line-height: 1.75; }
.prose p:first-of-type::first-letter {
  font-family: 'Fraunces', serif; font-size: 56px; font-weight: 700;
  float: left; line-height: 0.85; padding: 6px 8px 0 0; color: var(--accent);
}
.prose ul { font-size: 17px; padding-left: 22px; margin: 0 0 22px; }
.prose li { margin-bottom: 10px; line-height: 1.7; }
.prose strong { color: var(--ink); }
.unclear {
  background: linear-gradient(transparent 60%, rgba(177,135,47,0.25) 60%);
  padding: 0 2px; cursor: help;
}

/* ── Progress dots ───────────────────────────────────── */
.dots { display: flex; justify-content: center; gap: 10px; margin: 52px 0 0; }
.dots a {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line); text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.dots a:hover { transform: scale(1.35); background: var(--gold); }
.dots a.active { background: var(--accent); }
.dots a.done { background: var(--success); }

/* ── Pager ───────────────────────────────────────────── */
nav.pager {
  display: flex; justify-content: space-between;
  margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 14px;
}
nav.pager a, nav.pager span.disabled {
  color: var(--ink); text-decoration: none;
  display: flex; flex-direction: column; max-width: 45%;
}
nav.pager span.disabled { color: var(--line); }
nav.pager .dir { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 4px; }
nav.pager .label { font-family: 'Fraunces', serif; font-weight: 600; }
nav.pager a:hover .label { color: var(--accent); }
nav.pager .next { text-align: right; align-items: flex-end; }

/* ── Breadcrumb ──────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--line); }
