* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--surface); font: 400 16px/1.6 var(--ui); -webkit-font-smoothing: antialiased; font-synthesis: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: transparent; cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a { color: inherit; text-decoration: none; }
a:hover, .text-btn:hover, .source-link:hover strong { text-decoration: underline; text-underline-offset: .22em; }
:where(a,button,summary,input,textarea,select):focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
h1,h2,h3,h4,p,ol,ul { margin: 0; }
h1,h2,h3,.brand,.step-number,.card-number { font-family: var(--display); font-weight: 400; letter-spacing: -.022em; line-height: 1.12; }
h1 { font-size: clamp(46px, 5.4vw, 79px); font-weight: 300; }
h1 em { font-weight: 300; }
h2 { font-size: clamp(30px, 3vw, 46px); }
h3 { font-size: clamp(24px, 2.1vw, 34px); }
strong, h4 { font-weight: 500; }
svg { width: 17px; height: 17px; vertical-align: middle; flex-shrink: 0; }
.skip { position: fixed; top: -100px; left: 18px; z-index: 99; }
.skip:focus { top: 12px; padding: 12px; background: var(--ink); color: var(--surface); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding: 10px clamp(18px,4vw,64px); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: clamp(25px,2.5vw,38px); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.mark { width: 1.15em; aspect-ratio: 400/124; background: currentColor; mask: url("/assets/munier-glasses.svg") center / contain no-repeat; }
.top-actions,.private,.text-btn,.icon-btn,.secondary,.primary,.add-section,.comment-btn,.dock-actions,.auth-links,.start-actions,.guide-tools,.reader-meta,.reader-next,.intro-actions { display: flex; align-items: center; gap: 10px; }
.top-actions { gap: clamp(10px,2vw,26px); font-size: 13px; }
.private,.lede,.quiet,.dock-subtitle,.gate-card>p,.source-note,.source-link small,.empty,.old-version,time,.modal-subtitle,.prose + p,.history-item p,.access-list small,.gate-signature,.save-note { color: var(--muted); }
.icon-btn,.text-btn,.add-section,.comment-btn { min-height: 44px; font-size: 13px; padding: 6px 0; text-align: left; }
.icon-btn { min-width: 42px; justify-content: center; }
.primary,.secondary { min-height: 44px; justify-content: center; padding: 11px 18px; font-size: 14px; font-weight: 500; line-height: 1.35; }
.primary { background: var(--ink); color: var(--surface); clip-path: var(--chamfer); }
.primary:focus-visible { outline-color: var(--surface); outline-offset: -5px; }
.secondary { border: 1px solid var(--control-line); color: var(--ink); }
.secondary:hover,.icon-btn:hover,.nav-item:hover,.outline-card:hover,.nav-start:hover { background-color: var(--recess); }
.eyebrow,.overline,.nav-label,.start-badge { color: var(--muted); text-transform: uppercase; font-size: 10.5px; letter-spacing: .15em; font-weight: 500; }
.layout { display: grid; grid-template-columns: minmax(228px, 265px) minmax(0, 1fr); max-width: 1640px; margin: auto; }
.sidebar { position: sticky; top: 72px; height: calc(100dvh - 72px); overflow: auto; display: flex; flex-direction: column; gap: 18px; border-right: 1px solid var(--line); padding: 23px 17px 25px; scrollbar-width: thin; }
.nav-label,.sidebar-top .overline { display: block; margin: 0 8px 7px; }
.nav-item,.nav-start { position: relative; display: flex; align-items: center; gap: 9px; min-height: 40px; width: 100%; padding: 9px 10px; text-align: left; font-size: 13px; }
.nav-item.active,.nav-start.active { box-shadow: inset 1px 0 var(--rosso); background: var(--recess); font-weight: 500; }
.nav-start { display: grid; justify-items: start; gap: 4px; background: var(--recess); }
.nav-start>svg { position: absolute; right: 9px; bottom: 11px; }
.nav-start>span:nth-child(2) { padding-right: 14px; }
.nav-dot { width: 10px; height: 10px; border: 1px solid var(--control-line); flex: none; }
.nav-dot.approved { width: 13px; height: 13px; border: 0; }
.nav-dot svg { width: 13px; height: 13px; }
.nav-dot.changes { background: var(--muted); }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; }
.progress-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.progress-track { appearance: none; display: block; width: 100%; height: 3px; border: 0; margin: 10px 0; background: var(--recess); color: var(--ink); }
.progress-track::-webkit-progress-bar { background: var(--recess); }
.progress-track::-webkit-progress-value { background: var(--ink); }
.progress-track::-moz-progress-bar { background: var(--ink); }
main { min-width: 0; }
#main:not(.gate) { padding: clamp(35px,5vw,78px) clamp(25px,5vw,85px) 140px; }
.intro,.reading,.outline,.closing,.start-panel { max-width: 950px; margin-inline: auto; }
.intro,.reader-head { margin-bottom: 30px; }
.lede { max-width: 65ch; margin-top: 15px; }
.start-panel,.practice,.reading-tip,.guide-ready,.version-copy { background: var(--recess); border: 1px solid var(--line); padding: clamp(19px,3vw,36px); }
.start-panel,.guide-ready,.practice,.discussion,.source-panel,.guide-now,.process,.closing { margin-block: 27px; }
.start-panel h1,.start-panel h2,.section-heading h2,.chapter-title h2 { margin: 5px 0 10px; }
.start-panel p,.gate-intro>p,.closing p,.guide-now p,.process-steps p { max-width: 65ch; color: var(--muted); }
.start-actions,.guide-tools,.reader-next,.reader-meta,.auth-links,.modal-footer { flex-wrap: wrap; gap: 12px 20px; }
.start-actions { margin-top: 18px; }
.start-actions>span,.reader-breadcrumb,.reader-meta,.card-foot,.comment-by,.progress-label,.quiet,.form-error { font-size: 13px; }
.section-heading,.chapter-title,.lesson-header,.reader-breadcrumb,.reader-next,.modal-top,.modal-footer,.card-foot,.card-top,.access-list>div,.source-link { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.programme-group { margin: 28px 0 12px; }
.outline-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 26px; }
.outline-card { min-width: 0; display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 12px; padding: 18px 6px; border-top: 1px solid var(--line); }
.card-top { gap: 10px; }
.card-number { font-size: 23px; }
.card-foot { margin-top: auto; }
.outline-card p,.card-foot,.lesson p,.practice p,.history-item details,.comment-target { color: var(--muted); font-size: 14px; }
.status,.old-version,.resolved-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.status svg { width: 13px; height: 13px; }
.status.approved,.resolved-label { color: var(--ink); font-weight: 500; }
.status.changes,.change-note,.form-error { color: var(--ink); }
.closing { padding-block: 25px; border-top: 1px solid var(--line); }
.closing p,.closing button,.guide-ready button { margin-top: 14px; }
.reader-breadcrumb { margin-bottom: 20px; color: var(--muted); }
.reader-meta { margin-top: 18px; }
.prose p + p,.practice p + p { margin-top: 12px; }
.prose { max-width: 68ch; }
.chapter,.source-panel,.discussion,.guide-now,.process { padding-top: 23px; border-top: 1px solid var(--line); }
.chapter { margin: 36px 0; }
.lessons { margin-top: 9px; }
.lesson { padding: 18px 0; border-top: 1px solid var(--line); }
.lesson p { max-width: 75ch; margin: 5px 0; }
.comment-btn,.lesson-comments { font-size: 12px; }
.lesson-comments { margin-top: 6px; text-decoration: underline; }
.practice,.reading-tip,.comment,.history-item,.guide-ready,.how-icon,.comment-by { display: flex; align-items: flex-start; gap: 15px; }
.practice-icon,.reading-tip>span,.history-dot { color: var(--muted); }
.reading-tip p,.practice p,.save-note { font-size: 14px; }
.guide-ready { justify-content: space-between; align-items: center; }
.guide-ready p { margin-top: 5px; }
.how-to { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 22px; margin: 22px 0; }
.how-to h3,.process-steps h3 { font-size: 24px; margin: 6px 0; }
.process-steps,.source-panel ul { list-style: none; padding: 0; }
.process-steps li { display: flex; gap: 22px; padding: 16px 0; border-top: 1px solid var(--line); }
.step-number { min-width: 1.6em; font-size: 27px; }
.source-panel summary { cursor: pointer; padding: 6px 0; }
.source-link { width: 100%; padding: 13px 0; text-align: left; }
.source-panel li+li,.history-item+.history-item,.comment+.comment,.access-list>div+div { border-top: 1px solid var(--line); }
.source-link small { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.source-note,.access-list small,.dock-subtitle { display: block; font-size: 13px; }
.source-link[aria-busy=true] { opacity: .6; }
.comment,.history-item { padding: 17px 0; }
.comment-content,.history-item>div { min-width: 0; overflow-wrap: anywhere; }
.comment-content p,.version-copy p { white-space: pre-wrap; }
.avatar,.history-dot { min-width: 26px; }
.comment-by { align-items: baseline; flex-wrap: wrap; gap: 6px 12px; }
.discussion .empty,.comment-content p { margin: 12px 0; }
.reader-next,.guide-tools { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 9px; }
.review-dock { position: sticky; bottom: 0; z-index: 5; background: var(--recess); border: 1px solid var(--line); padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 32px auto 0; max-width: 950px; }
.dock-title { font-weight: 500; }
.mobile-nav { display: none; }
.gate { min-height: calc(100svh - 72px); display: grid; grid-template-columns: minmax(0,1.1fr) minmax(300px, .8fr); align-items: center; gap: clamp(30px,7vw,110px); max-width: 1420px; margin: auto; padding: clamp(32px,6vw,92px); }
.gate-intro h1 { font-size: clamp(52px,6vw,92px); }
.gate-intro>p { margin: 18px 0; max-width: 38ch; }
.gate-signature { display: flex; gap: 12px; align-items: center; margin-top: 25px; font: italic 300 clamp(22px,2.3vw,34px)/1.12 var(--display); }
.signature-line { width: 26px; height: 1px; background: var(--control-line); }
.gate-card,.modal { background: var(--recess); border: 1px solid var(--line); padding: clamp(21px,3.2vw,48px); }
.gate-card { max-width: 480px; width: 100%; }
.gate-card>p,.modal-subtitle { margin: 8px 0 21px; }
.gate-card label,.modal label { display: block; margin: 13px 0 5px; font-size: 14px; }
input,textarea,select { width: 100%; padding: 10px 9px; border: 1px solid var(--control-line); border-radius: 0; background: var(--surface); color: var(--ink); font-size: 16px; }
textarea { resize: vertical; }
.gate-card .primary { margin-top: 22px; width: 100%; }
.auth-links { justify-content: space-between; margin-top: 13px; }
.gate-note { color: var(--muted); font-size: 12px; }
.loading { display: grid; place-items: center; min-height: 80svh; color: var(--muted); }
.modal-open { overflow: hidden; }
.scrim { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.65); }
.modal { width: min(100%,580px); max-height: 90dvh; overflow: auto; }
.modal.wide { width: min(100%,800px); }
.modal-top h2 { margin-top: 5px; }
.modal-footer { margin-top: 18px; }
.modal-footer .quiet { max-width: 34ch; }
.editor-scroll,.history-list { max-height: 56dvh; overflow: auto; }
.edit-chapter,.version-copy,.access-list>div { margin-top: 12px; padding-top: 12px; }
.form-error:not(:empty) { margin: 12px 0; }
#toast { z-index: 100; opacity: 0; pointer-events: none; position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: 90vw; width: max-content; background: var(--ink); color: var(--surface); padding: 11px 18px; font-size: 14px; }
#toast.show { opacity: 1; }
@media (max-width: 780px) {
  .topbar { min-height: 60px; }
  .top-actions .private,.sidebar { display: none; }
  .layout { display: block; }
  #main:not(.gate) { padding: 30px 20px 100px; }
  .outline-grid,.how-to,.gate { grid-template-columns: 1fr; }
  .gate { align-content: start; padding: 32px 20px; min-height: auto; }
  .gate-card { max-width: 100%; }
  .gate-signature { margin-top: 10px; }
  .guide-ready,.section-heading,.chapter-title,.lesson-header,.review-dock { align-items: flex-start; flex-wrap: wrap; }
  .review-dock { bottom: 68px; }
  .comment-btn span { display: none; }
  .mobile-nav { display: flex; gap: 12px; align-items: center; position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; padding: 8px 16px max(8px,env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
  .mobile-nav select { flex: 1; min-width: 0; }
  .mobile-nav .icon-btn { flex: none; }
  .dock-actions { flex-wrap: wrap; }
  #toast { bottom: 78px; }
}
