:root {
  --bg: #f7f6f1;
  --surface: #fffefa;
  --ink: #171814;
  --muted: #707066;
  --line: #dcdad0;
  --accent: #365441;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Manrope', system-ui, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }
.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.site-header { position: sticky; top: 0; z-index: 50; height: 72px; padding: 0 max(20px, calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(220,218,208,.8); background: rgba(247,246,241,.92); backdrop-filter: blur(16px); }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 12px; letter-spacing: .08em; }
.main-nav { display: flex; gap: 8px; align-items: center; }
.nav-link { padding: 10px 13px; border-radius: 9px; color: #4f5049; font-size: 14px; font-weight: 600; }
.nav-link:hover { background: #eceae1; color: var(--ink); }
.nav-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: #e0ded3; font-size: 11px; }
.hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 40px; padding-top: 92px; padding-bottom: 64px; }
.hero-copy { max-width: 760px; }
.overline { display: block; margin-bottom: 14px; color: #5e675f; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.hero h1, .book-hero h1, .saved-hero h1 { margin: 0; font: 600 clamp(48px, 7vw, 92px)/.95 var(--serif); letter-spacing: -.045em; }
.hero h1 em { color: var(--accent); font-weight: 500; }
.hero-copy > p { max-width: 640px; margin: 30px 0 0; color: #5f6058; font-size: 18px; line-height: 1.7; }
.hero-stat { display: flex; flex-direction: column; align-items: flex-end; padding-bottom: 8px; }
.hero-stat strong { font: 600 50px/1 var(--serif); }
.hero-stat span { color: var(--muted); font-size: 12px; }
.discovery-panel { position: relative; z-index: 2; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 18px 60px rgba(37,36,31,.06); }
.search-box { display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 18px; border: 1px solid #d7d5cb; border-radius: 13px; background: #fbfaf6; }
.search-box span { font-size: 24px; color: #686a62; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; }
.topic-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.topic-chip { padding: 9px 13px; border: 1px solid #d9d7ce; border-radius: 999px; background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.topic-chip:hover, .topic-chip.active { border-color: #26352d; background: #26352d; color: #fff; }
.section-block { padding: 86px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.section-heading h2, .learning-path h2, .reader-section h2 { margin: 0; font: 600 clamp(34px, 4vw, 52px)/1.05 var(--serif); letter-spacing: -.035em; }
.result-count { color: var(--muted); font-size: 13px; }
.book-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px 24px; }
.book-card { display: grid; grid-template-columns: 138px 1fr; align-items: end; gap: 20px; min-width: 0; }
.book-cover { position: relative; display: flex; flex-direction: column; width: 138px; aspect-ratio: .68; padding: 18px 14px; overflow: hidden; border-radius: 4px 10px 10px 4px; background: var(--cover); color: var(--accent); box-shadow: 0 16px 30px rgba(25,25,22,.16), inset 6px 0 0 rgba(255,255,255,.18); transition: transform .22s ease, box-shadow .22s ease; }
.book-card:hover .book-cover { transform: translateY(-5px) rotate(-1deg); box-shadow: 0 22px 36px rgba(25,25,22,.2), inset 6px 0 0 rgba(255,255,255,.18); }
.cover-kicker { font-size: 8px; letter-spacing: .18em; font-weight: 800; opacity: .72; }
.book-cover strong { margin-top: auto; font: 600 20px/1.05 var(--serif); letter-spacing: -.03em; }
.book-cover small { margin-top: 8px; font-size: 8px; font-weight: 700; }
.cover-line { width: 28px; height: 2px; margin-top: 14px; background: var(--accent); opacity: .55; }
.book-card-copy { min-width: 0; padding-bottom: 4px; }
.eyebrow { color: #77776e; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.book-card h3 { margin: 10px 0 4px; font: 600 25px/1.05 var(--serif); letter-spacing: -.025em; }
.book-card p { margin: 0; color: var(--muted); font-size: 12px; }
.empty-state { grid-column: 1/-1; padding: 70px 24px; border: 1px dashed #cbc9bf; border-radius: 14px; color: var(--muted); text-align: center; }
.learning-path { display: grid; grid-template-columns: .8fr 1.2fr; gap: 80px; padding-top: 70px; padding-bottom: 90px; border-top: 1px solid var(--line); }
.learning-path > div:first-child > p { max-width: 480px; color: var(--muted); line-height: 1.75; }
.path-list { border-top: 1px solid var(--line); }
.path-list button { width: 100%; display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 22px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.path-list button:hover strong { transform: translateX(5px); }
.path-list span, .path-list small { color: var(--muted); font-size: 11px; }
.path-list strong { font: 600 22px/1.2 var(--serif); transition: transform .2s ease; }
.site-footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 40px 0 60px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.site-footer strong { color: var(--ink); }
.site-footer p { margin: 5px 0 0; }
.footer-note { max-width: 520px; justify-self: end; }
.book-hero { display: grid; grid-template-columns: 350px 1fr; gap: 86px; align-items: center; min-height: 690px; padding-top: 65px; padding-bottom: 75px; }
.book-hero-cover { display: grid; place-items: center; }
.book-cover-large { width: 270px; padding: 34px 28px; border-radius: 6px 18px 18px 6px; }
.book-cover-large strong { font-size: 40px; }
.book-cover-large small { font-size: 11px; }
.book-cover-large .cover-kicker { font-size: 10px; }
.back-link { display: inline-block; margin-bottom: 30px; color: var(--muted); font-size: 13px; font-weight: 700; }
.tag-row { display: flex; gap: 7px; margin-bottom: 17px; }
.tag-row span { padding: 7px 10px; border-radius: 999px; background: #e9e7dd; color: #62635b; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.book-hero h1 { font-size: clamp(52px, 7vw, 88px); }
.book-author { margin: 13px 0 0; color: #53554f; font-size: 14px; font-weight: 700; }
.book-lead { max-width: 650px; margin: 28px 0; color: #55574f; font-size: 17px; line-height: 1.75; }
.reading-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 26px; }
.reading-meta strong { font-size: 14px; }
.reading-meta span { color: var(--muted); font-size: 12px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px; border-radius: 10px; background: var(--ink); color: white; font-size: 13px; font-weight: 800; }
.reader-progress { position: fixed; z-index: 80; top: 71px; left: 0; width: 0; height: 2px; background: var(--accent); }
.reader-layout { display: grid; grid-template-columns: 220px 1fr; gap: 72px; padding-top: 30px; padding-bottom: 100px; border-top: 1px solid var(--line); }
.reader-toc { position: sticky; top: 105px; height: max-content; display: flex; flex-direction: column; gap: 12px; padding: 30px 0; }
.reader-toc a { color: #74766e; font-size: 12px; font-weight: 700; }
.reader-toc a:hover { color: var(--ink); }
.reader-article { max-width: 820px; }
.reader-section { scroll-margin-top: 110px; display: grid; grid-template-columns: 48px 1fr; gap: 24px; padding: 70px 0; border-bottom: 1px solid var(--line); }
.section-index { padding-top: 4px; color: #96968e; font: 600 16px/1 var(--serif); }
.reader-section h2 { margin-bottom: 30px; }
.lead-paragraph { margin: 0; font: 500 26px/1.55 var(--serif); letter-spacing: -.012em; }
.idea-list { border-top: 1px solid var(--line); }
.idea-item { display: grid; grid-template-columns: 52px 1fr; gap: 16px; padding: 25px 0; border-bottom: 1px solid var(--line); }
.idea-item > span { color: #96968e; font-size: 11px; font-weight: 800; }
.idea-item h3 { margin: 0 0 8px; font: 600 23px/1.2 var(--serif); }
.idea-item p { margin: 0; color: #5d5e57; line-height: 1.75; }
.lesson-list { display: grid; gap: 10px; }
.lesson-card { display: grid; grid-template-columns: 40px 1fr auto; gap: 15px; align-items: center; min-height: 88px; padding: 18px; border: 1px solid #d8d6cd; border-radius: 12px; background: var(--surface); }
.lesson-mark { color: #999991; font-size: 10px; font-weight: 800; }
.lesson-card p { margin: 0; font: 500 18px/1.45 var(--serif); }
.save-button { min-width: 74px; padding: 8px 10px; border: 1px solid #cfcdc3; border-radius: 8px; background: transparent; cursor: pointer; color: #60625b; font-size: 10px; font-weight: 800; }
.save-button:hover, .save-button.saved { border-color: #354d3f; background: #354d3f; color: #fff; }
.application-section ol { margin: 0; padding: 0; list-style: none; counter-reset: app; }
.application-section li { counter-increment: app; display: grid; grid-template-columns: 44px 1fr; gap: 10px; padding: 20px 0; border-bottom: 1px solid var(--line); color: #4f514a; line-height: 1.7; }
.application-section li::before { content: counter(app, decimal-leading-zero); color: #8d8e86; font-size: 11px; font-weight: 800; }
.completion-box { display: flex; flex-direction: column; align-items: flex-start; margin-top: 45px; padding: 30px; border-radius: 14px; background: #1e2922; color: #fff; }
.completion-box span { color: #b9c4bc; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.completion-box strong { margin: 8px 0 24px; font: 600 30px/1.1 var(--serif); }
.completion-box a { font-size: 12px; font-weight: 800; }
.saved-hero { padding: 90px 0 50px; }
.saved-hero h1 { font-size: clamp(50px, 7vw, 80px); }
.saved-hero p { color: var(--muted); }
.saved-grid { display: grid; gap: 10px; padding-bottom: 100px; }
.saved-card { display: grid; grid-template-columns: 1fr auto; gap: 30px; padding: 24px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.saved-card span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.saved-card p { margin: 8px 0 0; font: 500 21px/1.4 var(--serif); }
.saved-actions { display: flex; gap: 14px; align-items: center; }
.saved-actions a, .saved-actions button { font-size: 11px; font-weight: 800; }
.saved-actions button { border: 0; background: transparent; color: #8a4a41; cursor: pointer; }
.empty-state.large { min-height: 260px; display: grid; place-items: center; line-height: 2; }
.empty-page { min-height: 70vh; display: grid; place-items: center; align-content: center; gap: 24px; text-align: center; }
.empty-page h1 { font: 600 56px/1 var(--serif); }
@media (max-width: 950px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); }
  .book-hero { grid-template-columns: 260px 1fr; gap: 42px; }
  .book-cover-large { width: 220px; }
  .reader-layout { grid-template-columns: 1fr; }
  .reader-toc { display: none; }
  .learning-path { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 660px) {
  .container { width: min(100% - 28px, 1180px); }
  .site-header { height: 62px; padding: 0 14px; }
  .brand > span:last-child { display: none; }
  .nav-link { padding: 9px; font-size: 12px; }
  .hero { grid-template-columns: 1fr; padding-top: 54px; padding-bottom: 38px; }
  .hero h1 { font-size: 55px; }
  .hero-copy > p { margin-top: 20px; font-size: 15px; }
  .hero-stat { display: none; }
  .discovery-panel { width: calc(100% - 20px); padding: 14px; }
  .topic-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
  .topic-chip { flex: none; }
  .section-block { padding: 60px 0; }
  .section-heading { align-items: start; }
  .result-count { display: none; }
  .book-grid { grid-template-columns: 1fr; gap: 24px; }
  .book-card { grid-template-columns: 118px 1fr; }
  .book-cover { width: 118px; }
  .path-list button { grid-template-columns: 34px 1fr; }
  .path-list small { display: none; }
  .site-footer { grid-template-columns: 1fr; width: calc(100% - 28px); }
  .footer-note { justify-self: start; }
  .book-hero { grid-template-columns: 1fr; gap: 32px; min-height: auto; padding-top: 38px; }
  .book-hero-cover { order: 2; justify-content: start; }
  .book-cover-large { width: 170px; }
  .book-cover-large strong { font-size: 28px; }
  .book-hero h1 { font-size: 56px; }
  .reader-progress { top: 61px; }
  .reader-layout { padding-top: 0; }
  .reader-section { grid-template-columns: 1fr; gap: 10px; padding: 52px 0; }
  .section-index { display: none; }
  .lead-paragraph { font-size: 22px; }
  .lesson-card { grid-template-columns: 30px 1fr; }
  .save-button { grid-column: 2; justify-self: start; }
  .saved-card { grid-template-columns: 1fr; }
  .saved-actions { justify-content: space-between; }
}

/* Public card enrichment */
.book-card { align-items: start; }
.book-card-copy { padding-top: 8px; }
.book-card-author { margin-bottom: 12px !important; }
.book-card-summary { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 12px 0 14px !important; color: #5d5f57 !important; font-size: 12px !important; line-height: 1.6; }
.book-card-cta { color: var(--accent); font-size: 11px; font-weight: 800; }
.admin-nav-link { border: 1px solid #d2d0c6; }

/* Book Studio */
.admin-shell, .admin-editor { padding-top: 54px; padding-bottom: 90px; }
.admin-hero { display: flex; align-items: end; justify-content: space-between; gap: 36px; padding-bottom: 42px; }
.admin-hero h1, .editor-head h1 { margin: 0; font: 600 clamp(46px, 6vw, 76px)/.98 var(--serif); letter-spacing: -.04em; }
.admin-hero p, .editor-head p { max-width: 650px; color: var(--muted); line-height: 1.7; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 58px; }
.admin-stats article { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.admin-stats span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.admin-stats strong { display: block; margin-top: 8px; font: 600 36px/1 var(--serif); }
.admin-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.admin-toolbar h2 { margin: 0; font: 600 34px/1.1 var(--serif); }
.admin-toolbar p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.secondary-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 0 15px; border: 1px solid #cfcdc4; border-radius: 9px; background: var(--surface); font-size: 12px; font-weight: 800; }
.admin-card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.admin-book-card { display: grid; grid-template-columns: 126px 1fr; gap: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.admin-card-cover .book-cover { width: 126px; }
.admin-card-body { min-width: 0; }
.admin-card-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; }
.status-pill { padding: 5px 8px; border-radius: 999px; font-weight: 800; }
.status-pill.published { background: #deeadf; color: #31533b; }
.status-pill.draft { background: #ece9df; color: #69675e; }
.admin-card-body h3 { margin: 13px 0 3px; font: 600 25px/1.05 var(--serif); }
.admin-author { margin: 0 0 12px !important; color: var(--muted); font-size: 11px; font-weight: 700; }
.admin-card-body > p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; color: #5c5e56; font-size: 12px; line-height: 1.6; }
.admin-card-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 16px; }
.admin-card-actions a, .admin-card-actions button, .seed-label { font-size: 10px; font-weight: 800; }
.admin-card-actions a { color: #315442; }
.admin-card-actions button { border: 0; background: transparent; color: #9a4c42; cursor: pointer; padding: 0; }
.seed-label { color: #9a988e; }
.admin-note { margin-top: 30px; padding: 20px 22px; border: 1px dashed #c9c6bb; border-radius: 12px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.admin-note strong { color: var(--ink); }
.admin-note p { margin: 5px 0 0; }

/* Editor */
.editor-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding-bottom: 34px; }
.editor-head-actions { display: flex; gap: 9px; }
.book-form { display: grid; gap: 18px; }
.form-panel { padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.form-panel-head { display: grid; grid-template-columns: 42px 1fr; gap: 12px; margin-bottom: 26px; }
.form-panel-head > span { color: #98978f; font: 600 15px/1 var(--serif); }
.form-panel-head h2 { margin: 0; font: 600 28px/1.1 var(--serif); }
.form-panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.field { display: grid; gap: 8px; margin-top: 16px; }
.field-wide { grid-column: span 2; }
.field > span, .topic-fieldset legend { color: #55574f; font-size: 11px; font-weight: 800; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #d5d2c8; border-radius: 10px; background: #fbfaf6; color: var(--ink); padding: 12px 13px; outline: none; font: 500 13px/1.6 var(--sans); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #657b6d; box-shadow: 0 0 0 3px rgba(54,84,65,.08); }
.field textarea { resize: vertical; }
.field input[type="color"] { min-height: 46px; padding: 5px; }
.topic-fieldset { margin: 24px 0 0; padding: 0; border: 0; }
.topic-checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.topic-checks label { cursor: pointer; }
.topic-checks input { position: absolute; opacity: 0; pointer-events: none; }
.topic-checks span { display: inline-flex; padding: 9px 12px; border: 1px solid #d6d3ca; border-radius: 999px; font-size: 11px; font-weight: 700; }
.topic-checks input:checked + span { border-color: #26352d; background: #26352d; color: #fff; }
.mobile-save { display: none; }

@media (max-width: 950px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-card-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 660px) {
  .admin-nav-link { border: 0; }
  .admin-shell, .admin-editor { padding-top: 34px; }
  .admin-hero, .editor-head, .admin-toolbar { align-items: flex-start; flex-direction: column; }
  .admin-hero .primary-button { width: 100%; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); margin-bottom: 42px; }
  .admin-book-card { grid-template-columns: 92px 1fr; padding: 12px; }
  .admin-card-cover .book-cover { width: 92px; padding: 12px 10px; }
  .admin-card-cover .book-cover strong { font-size: 15px; }
  .admin-card-body h3 { font-size: 21px; }
  .admin-card-body > p { -webkit-line-clamp: 2; }
  .editor-head-actions { display: none; }
  .form-panel { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .mobile-save { display: block; position: sticky; bottom: 10px; z-index: 20; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(247,246,241,.94); backdrop-filter: blur(10px); }
  .mobile-save .primary-button { width: 100%; }
}
