/* The M1 look, from the design canvas (M1 · Write and return). */
:root {
  --ink: #16181d; --text: #2a2e35; --muted: #4a5059; --quiet: #6a7079; --faint: #8a9099;
  --line: #e6e8eb; --soft: #f1f2f4; --accent: #2f4fcf; --danger: #b42318; --danger-dot: #d92d20;
  --code-bg: #1a1b26; --code-fg: #c0caf5;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #fff; }
body { color: var(--ink); font-family: "Geist", system-ui, sans-serif; font-size: 17px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: #203aa8; }
.root { min-height: 100vh; display: flex; flex-direction: column; }

.header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; }
.crumbs { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; line-height: 1; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.logo:hover { color: var(--ink); }
.stage { padding: 4px 7px; border-radius: 999px; background: #fff6e5; color: #6b3a06; font-size: 11px; font-weight: 600; }
.sep { color: #c4c8ce; }
.crumb-title { min-width: 0; max-width: 48ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.crumb-title.placeholder { color: var(--quiet); }
.header-right { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; margin-left: auto; font-size: 13px; line-height: 1; }
.status { color: var(--quiet); display: flex; align-items: center; gap: 7px; }
.status.failed { color: var(--danger); }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger-dot); }
.toggle { display: flex; gap: 2px; padding: 2px; background: #f2f3f5; border-radius: 999px; }
.toggle button { height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; }
.toggle button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(22, 24, 29, 0.1); cursor: default; }

.changed-elsewhere { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 20px; padding: 12px 28px; background: #fff6e5; border-top: 1px solid #f5ddb0; border-bottom: 1px solid #f5ddb0; font-size: 14.5px; line-height: 1.5; color: #6b3a06; }
.changed-elsewhere span { max-width: 70ch; }
.changed-elsewhere button { height: 34px; padding: 0 16px; border: 1px solid var(--ink); border-radius: 999px; background: var(--ink); color: #fff; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }

.page-main { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 700px; margin: 0 auto; padding: 72px 24px 0; }
.page-main[hidden] { display: none; }
.page-below { flex: 1; min-height: 160px; cursor: text; }
.page-editor { outline: none; color: var(--text); }
/* Block rhythm. Margins are reset with zero specificity, then spacing is set only between top-level blocks,
   so element rules can never undo the rhythm. */
.page-editor :where(p, ul, ol, blockquote, pre, h1, h2, h3, h4, h5, h6, hr) { margin: 0; }
.page-editor > * + * { margin-top: 14px; }
.page-editor > h1:not([data-title]), .page-editor > h2 { margin-top: 48px; }
.page-editor > h3 { margin-top: 36px; }
.page-editor > :is(h4, h5, h6) { margin-top: 28px; }
.page-editor > :is(blockquote, pre) { margin-top: 28px; }
.page-editor > hr, .page-editor > hr + * { margin-top: 36px; }
.page-editor > :is(h1, h2, h3, h4, h5, h6):not([data-title]) + * { margin-top: 16px; }
.page-editor > h1[data-title] + * { margin-top: 28px; }

.page-editor h1[data-title] { font-size: 44px; line-height: 1.12; font-weight: 650; letter-spacing: -0.025em; color: var(--ink); }
.page-editor h1:not([data-title]) { font-size: 30px; line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
.page-editor h2 { font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -0.015em; color: var(--ink); }
.page-editor h3 { font-size: 18.5px; line-height: 1.35; font-weight: 600; color: var(--ink); }
.page-editor h4, .page-editor h5, .page-editor h6 { font-size: 17px; font-weight: 600; color: var(--ink); }
.page-editor strong { font-weight: 650; }
.page-editor a { color: var(--accent); }
.page-editor code { padding: 1px 6px; border-radius: 5px; background: var(--soft); font-family: "Geist Mono", ui-monospace, monospace; font-size: 0.86em; color: var(--text); }

/* Lists: the same spacing between items in every kind of list. */
.page-editor ul, .page-editor ol { padding-left: 24px; }
.page-editor li + li, .page-editor li > :is(ul, ol) { margin-top: 4px; }
.page-editor ul[data-type="taskList"] { list-style: none; padding-left: 0; }
.page-editor ul[data-type="taskList"] li { display: flex; align-items: flex-start; gap: 12px; }
/* The checkbox sits in a box one text line tall, so it centres on the first line of its item. */
.page-editor ul[data-type="taskList"] li > label { flex: none; display: flex; align-items: center; height: 1.7em; }
.page-editor ul[data-type="taskList"] li > label > span { display: none; }
.page-editor ul[data-type="taskList"] li > label input { width: 17px; height: 17px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.page-editor ul[data-type="taskList"] li > div { flex: 1; min-width: 0; }
.page-editor ul[data-type="taskList"] li[data-checked="true"] > div { color: var(--quiet); }
.page-editor ul[data-type="taskList"] ul[data-type="taskList"] { padding-left: 0; }

.page-editor blockquote { padding: 2px 0 2px 18px; border-left: 3px solid #e3e5e9; color: var(--muted); }
.page-editor hr { border: 0; border-top: 1px solid var(--line); }
.page-editor hr.ProseMirror-selectednode { border-top-color: var(--accent); }
.page-editor pre { padding: 18px 20px; border-radius: 10px; background: var(--code-bg); color: var(--code-fg); overflow-x: auto; }
.page-editor pre code { padding: 0; background: none; color: inherit; font-size: 14px; line-height: 1.7; }
.page-editor .is-empty::before { content: attr(data-placeholder); float: left; height: 0; pointer-events: none; color: var(--quiet); }
.page-editor h1[data-title].is-empty::before { color: var(--faint); }

/* Tokyo Night, for code blocks (M1.12). */
.hljs-keyword, .hljs-selector-tag, .hljs-built_in.hljs-keyword, .hljs-meta .hljs-keyword { color: #bb9af7; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #7aa2f7; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-template-tag { color: #9ece6a; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: #ff9e64; }
.hljs-comment, .hljs-quote, .hljs-deletion { color: #8a93bf; font-style: italic; }
.hljs-operator, .hljs-punctuation, .hljs-meta { color: #89ddff; }
.hljs-attr, .hljs-property, .hljs-attribute { color: #73daca; }
.hljs-type, .hljs-built_in, .hljs-class .hljs-title, .hljs-title.class_ { color: #2ac3de; }
.hljs-variable, .hljs-template-variable, .hljs-params { color: #e0af68; }
.hljs-tag, .hljs-name { color: #f7768e; }

.md-main { width: 100%; max-width: 860px; margin: 0 auto; padding: 48px 24px 160px; }
.md-panel { border: 1px solid #eceef0; border-radius: 10px; background: #f8f9fa; overflow: hidden; }
.md-head { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #eceef0; font-size: 13px; line-height: 1.4; color: var(--quiet); }
.md-lines { padding: 14px 0 18px; overflow-x: auto; font-family: "Geist Mono", ui-monospace, monospace; font-size: 14px; line-height: 24px; color: var(--text); }
.md-line { display: flex; gap: 20px; padding-right: 20px; }
.md-n { flex: none; width: 40px; text-align: right; color: var(--quiet); user-select: none; }
.md-text { flex: 1 1 auto; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 24px; }

.not-found { width: 100%; max-width: 700px; margin: 0 auto; padding: 160px 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.not-found h1 { margin: 0; font-size: 44px; line-height: 1.12; font-weight: 650; letter-spacing: -0.025em; }
.not-found p { margin: 0; color: var(--muted); }
.primary { display: inline-flex; border: 0; font-family: inherit; cursor: pointer; align-items: center; height: 40px; margin-top: 8px; padding: 0 18px; border-radius: 999px; background: var(--ink); color: #fff; text-decoration: none; font-size: 15px; font-weight: 500; }
.primary:hover { color: #fff; }

@media (max-width: 600px) {
  .header { padding: 12px 16px; }
  .page-main { padding-top: 40px; }
  .page-editor h1[data-title] { font-size: 34px; }
}
