/* MatsLab Docs 0.6 — editor, public reader (MatsView) and sign-in notice. Light and dark. */

:root {
  color-scheme: light;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  --serif: "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9edf2;
  --ink: #142235;
  --ink-2: #4b5b6d;
  --ink-3: #7a8796;
  --line: #e2e7ee;
  --line-2: #d0d8e2;
  --accent: #176bea;
  --accent-hover: #0f5cd0;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fd;
  --accent-line: #c8dafb;
  --danger: #c0303d;
  --danger-soft: #fdecee;
  --warn: #a2560c;
  --warn-soft: #fff4e5;
  --ok: #19733e;
  --ok-soft: #e7f6ec;
  --mark: #fff0a1;
  --code-bg: #f1f4f8;
  --shadow-sm: 0 1px 2px rgba(16, 32, 52, 0.06);
  --shadow-pop: 0 12px 40px rgba(16, 32, 52, 0.16), 0 2px 6px rgba(16, 32, 52, 0.08);
  --radius: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --fmt-md: #176bea;
  --fmt-txt: #64748b;
  --fmt-html: #c2410c;
  --fmt-docx: #2563eb;
  --fmt-pdf: #c0303d;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1116;
  --surface: #141920;
  --surface-2: #181e26;
  --surface-3: #212833;
  --ink: #e7ecf2;
  --ink-2: #a9b4c1;
  --ink-3: #7c8897;
  --line: #242c37;
  --line-2: #323c49;
  --accent: #5c9cff;
  --accent-hover: #7aaeff;
  --accent-ink: #07111f;
  --accent-soft: #15253c;
  --accent-line: #24406a;
  --danger: #ff7b86;
  --danger-soft: #3a171c;
  --warn: #f3b25a;
  --warn-soft: #34250f;
  --ok: #6ad397;
  --ok-soft: #12301f;
  --mark: #5a4a00;
  --code-bg: #1d242e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  --fmt-md: #6aa5ff;
  --fmt-txt: #94a3b8;
  --fmt-html: #fb923c;
  --fmt-docx: #7aa7ff;
  --fmt-pdf: #ff7b86;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1116;
    --surface: #141920;
    --surface-2: #181e26;
    --surface-3: #212833;
    --ink: #e7ecf2;
    --ink-2: #a9b4c1;
    --ink-3: #7c8897;
    --line: #242c37;
    --line-2: #323c49;
    --accent: #5c9cff;
    --accent-hover: #7aaeff;
    --accent-ink: #07111f;
    --accent-soft: #15253c;
    --accent-line: #24406a;
    --danger: #ff7b86;
    --danger-soft: #3a171c;
    --warn: #f3b25a;
    --warn-soft: #34250f;
    --ok: #6ad397;
    --ok-soft: #12301f;
    --mark: #5a4a00;
    --code-bg: #1d242e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
    --fmt-md: #6aa5ff;
    --fmt-txt: #94a3b8;
    --fmt-html: #fb923c;
    --fmt-docx: #7aa7ff;
    --fmt-pdf: #ff7b86;
  }
}

:root { --read-size: 1.125rem; }
:root[data-read-size="s"] { --read-size: 1rem; }
:root[data-read-size="l"] { --read-size: 1.25rem; }
:root[data-read-size="xl"] { --read-size: 1.375rem; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- buttons ---------- */

button, .button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  border-radius: 9px; padding: 8px 14px; min-height: 38px; cursor: pointer;
  font-size: .875rem; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
button:hover, .button:hover, .btn:hover { background: var(--surface-2); border-color: var(--line-2); }
button:active:not(:disabled), .btn:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
.btn.primary, button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover, button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost, button.quiet { background: transparent; border-color: transparent; }
.btn.ghost:hover, button.quiet:hover { background: var(--surface-2); }
.btn.danger, button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-text { background: transparent; border-color: transparent; color: var(--danger); }
.btn.danger-text:hover { background: var(--danger-soft); }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: .8125rem; border-radius: 8px; }
.btn.block { width: 100%; justify-content: flex-start; }
.icon-btn { min-height: 38px; min-width: 38px; padding: 0; border-color: transparent; background: transparent; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.sm { min-height: 30px; min-width: 30px; font-size: .85rem; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn circle { fill: currentColor; stroke: none; }

.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.seg button { min-height: 30px; padding: 4px 12px; border: 0; background: transparent; color: var(--ink-2); border-radius: 8px; font-size: .8125rem; }
.seg button:hover { background: var(--surface-3); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

.chip { min-height: 30px; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--ink-2); background: var(--surface); }
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1; }

/* ---------- workspace ---------- */

.app { overflow: hidden; }
.workspace { display: grid; grid-template-columns: 272px minmax(0, 1fr); height: 100dvh; min-height: 420px; }

.sidebar {
  display: flex; flex-direction: column; gap: 14px; min-height: 0;
  background: var(--surface-2); border-right: 1px solid var(--line);
  padding: max(18px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 2px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 1.02rem; letter-spacing: -.02em; white-space: nowrap; }
.brand b { font-weight: 750; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: .95rem; }
.side-actions { display: grid; gap: 8px; }
.new-types { display: flex; gap: 6px; flex-wrap: wrap; }
.upload-btn {
  display: grid; gap: 1px; padding: 9px 12px; border: 1px dashed var(--line-2); border-radius: 10px; cursor: pointer;
  color: var(--ink-2); font-size: .85rem; font-weight: 600; background: transparent; transition: background .15s, border-color .15s;
}
.upload-btn small { color: var(--ink-3); font-weight: 500; font-size: .72rem; }
.upload-btn:hover { background: var(--surface); border-color: var(--accent-line); color: var(--ink); }
.side-search input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 8px 11px; font-size: .85rem; outline: 0;
}
.side-search input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.doc-list { overflow: auto; flex: 1; min-height: 0; margin: 0 -6px; padding: 0 6px; overscroll-behavior: contain; }
.doc {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%;
  min-height: 52px; margin: 1px 0; padding: 7px 8px; text-align: left; background: transparent; border: 1px solid transparent;
  border-radius: 10px; font-weight: 500;
}
.doc:hover { background: var(--surface-3); }
.doc.active { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-sm); }
.doc-icon {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; font-size: .6rem; font-weight: 800; letter-spacing: .03em;
  color: var(--c, var(--fmt-txt)); background: color-mix(in srgb, var(--c, var(--fmt-txt)) 13%, transparent);
}
.fmt-md { --c: var(--fmt-md); } .fmt-txt { --c: var(--fmt-txt); } .fmt-html { --c: var(--fmt-html); } .fmt-docx { --c: var(--fmt-docx); } .fmt-pdf { --c: var(--fmt-pdf); }
.doc-main { display: grid; min-width: 0; }
.doc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; font-weight: 600; }
.doc-meta { font-size: .72rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-empty { font-size: .85rem; color: var(--ink-3); padding: 10px; }
.side-appearance { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; font-size: .75rem; font-weight: 600; color: var(--ink-3); }
.side-appearance .seg button { min-height: 26px; padding: 2px 9px; font-size: .75rem; }
.side-foot { margin: 0; }
.side-foot button { color: var(--ink-3); font-weight: 500; }
.side-site { margin-bottom: 4px; color: var(--ink-2); font-weight: 500; }
.scrim { display: none; }
.only-narrow { display: none !important; }

/* ---------- editor shell ---------- */

.editor { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.topbar {
  display: flex; align-items: center; gap: 12px; min-height: 64px;
  padding: max(10px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 10px 20px; border-bottom: 1px solid var(--line);
}
#menu { display: none; }
.title-wrap { flex: 1; min-width: 0; }
#title {
  display: block; width: 100%; border: 0; outline: 0; background: transparent; padding: 2px 0;
  font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink); text-overflow: ellipsis;
}
#title:focus { box-shadow: 0 2px 0 var(--accent); }
#title:disabled { opacity: 1; }
.meta-line { display: flex; align-items: center; gap: 8px; min-height: 20px; font-size: .75rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.type-badge { font-size: .62rem; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.privacy { padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.privacy.is-public { background: var(--warn-soft); color: var(--warn); }
#status { overflow: hidden; text-overflow: ellipsis; }
#status.status-locked { color: var(--warn); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.comments-btn { position: relative; }
.comments-btn .count-badge { margin-left: 2px; }
.comments-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.menu-wrap { position: relative; }

.pop-menu {
  position: fixed; z-index: 60; min-width: 200px; max-width: min(320px, calc(100vw - 16px)); max-height: min(60vh, 440px); overflow: auto;
  padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop);
  animation: pop .14s var(--ease);
}
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.pop-item {
  display: flex; width: 100%; justify-content: flex-start; min-height: 36px; padding: 7px 10px; border: 0; border-radius: 8px;
  background: transparent; font-weight: 500; font-size: .875rem; text-align: left;
}
.pop-item:hover, .pop-item:focus-visible, .pop-item.active { background: var(--accent-soft); color: var(--ink); outline: 0; }
.pop-item.danger { color: var(--danger); }
.pop-item.danger:hover { background: var(--danger-soft); }
.pop-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.pop-item.h1 { font-size: 1.15rem; font-weight: 750; } .pop-item.h2 { font-size: 1.04rem; font-weight: 700; } .pop-item.h3 { font-size: .95rem; font-weight: 700; }
.pop-item.co::before { content: ''; width: 9px; height: 9px; border-radius: 3px; margin: 0 9px 0 2px; align-self: center; background: var(--cc, var(--accent)); }
.co-tip { --cc: #0d9488; } .co-important { --cc: #7c3aed; } .co-warning { --cc: #d97706; } .co-danger { --cc: #dc2626; } .co-success { --cc: #16a34a; } .co-question { --cc: #2563eb; } .co-example { --cc: #64748b; } .co-quote { --cc: #94a3b8; } .co-todo { --cc: #3b82f6; }
.pop-item.f-mono { font-family: var(--mono); } .pop-item.f-serif { font-family: var(--serif); }
.slash-menu { width: 260px; }
.slash-head { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 6px 10px 4px; }

/* ---------- type bar + tools ---------- */

.typebar {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 7px 20px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.type-switch button { font-size: .72rem; font-weight: 800; letter-spacing: .05em; padding: 4px 10px; }
.type-switch button[aria-pressed="true"][data-format="md"] { color: var(--fmt-md); }
.type-switch button[aria-pressed="true"][data-format="html"] { color: var(--fmt-html); }
.type-fixed { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; font-size: .85rem; color: var(--ink-2); }
.type-fixed > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-pill { font-size: .66rem; font-weight: 800; letter-spacing: .05em; padding: 3px 8px; border-radius: 6px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.type-actions { display: flex; gap: 6px; margin-left: auto; }
.tools { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.tools-main {
  display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}
.tools-main::-webkit-scrollbar { display: none; }
.tools-right { display: flex; align-items: center; gap: 4px; }
.tool-group { display: flex; align-items: center; gap: 2px; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--line); }
.tool-group:last-child { border-right: 0; }
.tools-right .tool-group { border: 0; padding: 0; margin: 0; }
.tool {
  min-height: 34px; min-width: 34px; padding: 0 7px; border: 1px solid transparent; background: transparent;
  color: var(--ink-2); border-radius: 8px; font-size: .875rem; font-weight: 700;
}
.tool:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.tool[aria-pressed="true"], .tool[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.tool.has-label { padding: 0 9px; gap: 5px; font-weight: 600; font-size: .8125rem; }
.tool .ico + .ico { width: 13px; height: 13px; margin-left: -2px; opacity: .6; }
.tool-select { min-width: 132px; justify-content: space-between; border-color: var(--line); background: var(--surface); }
.tool-select .tool-label { overflow: hidden; text-overflow: ellipsis; }
.t-b span { font-weight: 850; } .t-i span { font-style: italic; font-family: var(--serif); font-weight: 600; font-size: 1rem; }
.t-u span { text-decoration: underline; text-underline-offset: 2px; } .t-s span { text-decoration: line-through; }
.t-mark span { background: var(--mark); color: var(--ink); padding: 0 4px; border-radius: 4px; }
.tool-context { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.tools.is-readonly .tools-main { opacity: .55; }

.findbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 20px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); animation: pop .14s var(--ease);
}
.find-row { display: flex; align-items: center; gap: 6px; }
.findbar input:not([type=checkbox]) {
  width: 220px; max-width: 46vw; border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; padding: 6px 10px; font-size: .85rem; outline: 0;
}
.findbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.find-count { min-width: 64px; font-size: .78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.find-case { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--ink-2); }
.findbar.read-only .find-row:nth-child(2) { display: none; }

#error { background: var(--danger-soft); color: var(--danger); padding: 10px 20px; font-size: .875rem; border-bottom: 1px solid var(--line); }

/* ---------- stage ---------- */

.stage { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); background: var(--surface); }
.stage[data-view="split"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stage.with-panel { grid-template-columns: minmax(0, 1fr) 320px; }
.stage[data-view="split"].with-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 320px; }
.pane { min-height: 0; min-width: 0; position: relative; }
.edit-pane { display: flex; }
.edit-pane.drop::after { content: 'Drop to add the picture'; position: absolute; inset: 12px; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--accent-soft) 80%, transparent); color: var(--accent); font-weight: 700; pointer-events: none; }
.stage[data-view="split"] .edit-pane { border-right: 1px solid var(--line); }
textarea#body {
  flex: 1; width: 100%; height: 100%; resize: none; border: 0; outline: 0; background: var(--surface); color: var(--ink);
  padding: 40px max(28px, calc((100% - 820px) / 2)) 30vh; font-size: 1rem; line-height: 1.8; tab-size: 2;
  font-family: var(--mono); caret-color: var(--accent);
}
.stage[data-view="split"] textarea#body { padding-left: 28px; padding-right: 28px; font-size: .95rem; }
textarea#body.font-sans { font-family: var(--font); font-size: 1.0625rem; }
textarea#body.font-serif { font-family: var(--serif); font-size: 1.125rem; line-height: 1.75; }
textarea#body.nowrap { white-space: pre; overflow-wrap: normal; overflow-x: auto; }
textarea#body::placeholder { color: var(--ink-3); }
textarea#body:disabled { opacity: 1; background: var(--surface); color: var(--ink); }
textarea#body::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.doc-locked textarea#body { cursor: default; }

.preview-pane { overflow: auto; overscroll-behavior: contain; padding: 40px max(28px, calc((100% - 780px) / 2)) 30vh; background: var(--surface); scroll-behavior: smooth; }
.stage[data-view="split"] .preview-pane { background: var(--bg); padding-left: 32px; padding-right: 32px; }

.binary-pane { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--surface-2); }
#pdf-frame, .oo-host { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; min-height: 0; }
.muted { color: var(--ink-3); font-size: .9rem; padding: 16px; }

.empty { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; background: var(--surface); }
.empty-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); font-size: 2rem; }
.empty h1 { font-size: 1.6rem; letter-spacing: -.03em; margin: 18px 0 6px; }
.empty p { color: var(--ink-2); margin: 0 0 22px; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.side-panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--surface-2); animation: slide-in .18s var(--ease); }
@keyframes slide-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 16px; }
.panel-head h2 { font-size: .8rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin: 0; }
.panel-body { flex: 1; overflow: auto; padding: 0 12px 20px; overscroll-behavior: contain; }
.panel-empty { color: var(--ink-3); font-size: .85rem; padding: 6px 4px; line-height: 1.55; }
.outline { list-style: none; margin: 0; padding: 0; }
.outline-item { display: block; width: 100%; min-height: 32px; padding: 6px 8px; border: 0; background: transparent; text-align: left; font-weight: 500; font-size: .85rem; color: var(--ink-2); white-space: normal; border-radius: 7px; justify-content: flex-start; }
.outline-item:hover { background: var(--surface-3); color: var(--ink); }
.outline-item.lvl-1 { font-weight: 700; color: var(--ink); } .outline-item.lvl-2 { padding-left: 20px; } .outline-item.lvl-3 { padding-left: 32px; font-size: .8125rem; } .outline-item.lvl-4, .outline-item.lvl-5, .outline-item.lvl-6 { padding-left: 44px; font-size: .78rem; }

.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; margin: 4px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.switch-row input { margin-top: 3px; }
.switch-row span { display: grid; gap: 2px; font-size: .875rem; }
.switch-row small { color: var(--ink-3); font-size: .78rem; line-height: 1.45; }
.switch-row.compact { margin-top: 0; }
.cm-tabs { display: flex; width: 100%; margin-bottom: 12px; }
.cm-tabs button { flex: 1; }
.cm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cm-item { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.cm-head, .comment-head { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.cm-head time, .comment-head time { margin-left: auto; color: var(--ink-3); font-size: .75rem; white-space: nowrap; }
.comment-avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: .75rem; flex: none; }
.cm-body { margin: 8px 0 10px; font-size: .875rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.cm-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.cm-item.is-reply { margin-left: 18px; background: var(--surface-2); }
.cm-replies, .comment-replies { list-style: none; margin: 10px 0 0; padding: 0 0 0 14px; display: grid; gap: 10px; border-left: 2px solid var(--line-2); }
.comment-badge { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .7rem; font-weight: 700; letter-spacing: .02em; }
.cm-reply-box { margin-top: 10px; display: grid; gap: 8px; }
.cm-reply-box textarea { width: 100%; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.cm-reply-box textarea:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px var(--accent-soft); }
.cm-reply-actions { display: flex; gap: 6px; justify-content: flex-end; }
.comment.is-author { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.comment.is-reply { background: var(--surface-2); }


.statusbar { display: flex; align-items: center; gap: 14px; padding: 7px 20px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--ink-3); font-size: .75rem; font-variant-numeric: tabular-nums; background: var(--surface); }
.statusbar .spacer { flex: 1; }

/* ---------- dialogs ---------- */

dialog {
  border: 1px solid var(--line); border-radius: 18px; padding: 26px; width: calc(100% - 32px); max-width: 520px;
  color: var(--ink); background: var(--surface); box-shadow: var(--shadow-pop);
}
dialog[open] { animation: pop .18s var(--ease); }
dialog::backdrop { background: rgba(8, 18, 32, .45); backdrop-filter: blur(3px); }
dialog h2 { margin: 2px 40px 12px 0; font-size: 1.3rem; letter-spacing: -.02em; }
dialog p { color: var(--ink-2); line-height: 1.6; font-size: .9375rem; }
dialog .close { position: absolute; right: 14px; top: 14px; }
dialog .field { display: grid; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin: 12px 0; }
dialog input:not([type=checkbox]), dialog select {
  width: 100%; border: 1px solid var(--line-2); padding: 10px 12px; border-radius: 9px; background: var(--surface); color: var(--ink); font-size: .9375rem; font-weight: 400; outline: 0;
}
dialog input:focus, dialog select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check-row { display: flex; gap: 9px; align-items: flex-start; font-size: .85rem; color: var(--ink-2); margin: 12px 0; line-height: 1.45; }
.check-row.inline { margin: 0; align-items: center; }
.check-row input, .switch-row input, .find-case input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.form-error { color: var(--danger); font-size: .85rem; margin: 8px 0 0; }
.link-row { display: flex; gap: 8px; }
.small { font-size: .8125rem; color: var(--ink-3); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
#share-error { color: var(--danger); font-size: .85rem; }
.public-warn { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: .85rem; line-height: 1.5; margin: 0 0 12px; }
dialog.table-dialog { max-width: min(900px, calc(100% - 24px)); }
dialog.image-dialog { max-width: min(520px, calc(100% - 24px)); }

/* table editor */
.te-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 12px; }
.tb-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 2px; }
.te-meta { margin-left: auto; font-size: .75rem; color: var(--ink-3); white-space: nowrap; }
.te-grid-wrap { overflow: auto; max-height: min(52vh, 460px); border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 8px; }
.te-grid { border-collapse: collapse; width: 100%; min-width: 280px; background: var(--surface); table-layout: fixed; }
.te-grid th, .te-grid td { border: 1px solid var(--line-2); min-width: 72px; padding: 0; vertical-align: top; background: var(--surface); }
.te-grid th { background: var(--surface-3); font-weight: 650; }
.te-grid th[contenteditable], .te-grid td[contenteditable] { padding: 8px 10px; outline: none; cursor: text; word-break: break-word; font-size: .875rem; line-height: 1.35; min-height: 36px; }
.te-grid .te-selected { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft) !important; }
.te-cell-img { display: block; max-width: 100%; max-height: 120px; height: auto; margin: 0 auto 4px; border-radius: 6px; }
.te-cell-img-cap { font-size: .7rem; color: var(--ink-3); text-align: center; line-height: 1.2; }

/* ---------- prose (editor preview + public reader) ---------- */

.prose, .plain { max-width: 780px; margin: 0 auto; color: var(--ink); font-size: 1.0625rem; line-height: 1.8; overflow-wrap: anywhere; }
.plain { white-space: pre-wrap; font-family: var(--mono); font-size: .95rem; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { letter-spacing: -.025em; line-height: 1.25; margin: 1.5em 0 .5em; scroll-margin-top: 5.5rem; }
.prose h1 { font-size: 2rem; } .prose h2 { font-size: 1.5rem; } .prose h3 { font-size: 1.22rem; } .prose h4 { font-size: 1.05rem; }
.prose p { margin: .85em 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: .85em 0; }
.prose li { margin: .2em 0; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow: auto; font-size: .875rem; line-height: 1.6; }
.prose code { font-family: var(--mono); font-size: .88em; }
.prose :not(pre) > code { background: var(--code-bg); padding: .12em .38em; border-radius: 5px; }
.prose blockquote { margin: 1em 0; padding: .15em 0 .15em 1.1em; border-left: 3px solid var(--line-2); color: var(--ink-2); }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose mark { background: var(--mark); color: inherit; padding: .05em .25em; border-radius: 4px; }
.prose del { color: var(--ink-3); }
.prose .wiki-link { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-line); }
.prose .wiki-link:hover { border-bottom-color: var(--accent); }
.prose .wiki-link.unresolved { color: var(--warn); border-bottom: 1px dashed currentColor; cursor: help; }
.prose ul.task-list, .prose ol.task-list { list-style: none; padding-left: .2em; }
.prose .task-list-item { display: flex; align-items: flex-start; gap: .6em; margin: .35em 0; }
.prose .task-checkbox { margin-top: .4em; flex: none; pointer-events: none; accent-color: var(--accent); width: 16px; height: 16px; }
.prose .task-text { min-width: 0; }
.prose .table-wrap { overflow: auto; margin: 1.2em 0; border: 1px solid var(--line); border-radius: 12px; }
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: .6em .8em; text-align: left; vertical-align: top; }
.prose thead th { background: var(--surface-2); font-weight: 700; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td img, .prose th img { display: block; max-height: 220px; width: auto; max-width: 100%; margin: 4px 0; border-radius: 8px; }
.prose .callout { --cc: #3b82f6; margin: 1.2em 0; padding: 12px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--cc) 30%, var(--line)); border-left: 4px solid var(--cc); background: color-mix(in srgb, var(--cc) 8%, var(--surface)); }
.prose .callout-title { font-weight: 750; font-size: .92rem; margin: 0 0 .3em; color: color-mix(in srgb, var(--cc) 70%, var(--ink)); }
.prose .callout-body > :first-child { margin-top: 0; } .prose .callout-body > :last-child { margin-bottom: 0; }
.prose .callout-tip { --cc: #0d9488; } .prose .callout-important { --cc: #7c3aed; } .prose .callout-warning { --cc: #d97706; }
.prose .callout-caution, .prose .callout-danger { --cc: #dc2626; } .prose .callout-success { --cc: #16a34a; } .prose .callout-question { --cc: #2563eb; }
.prose .callout-example { --cc: #64748b; } .prose .callout-quote { --cc: #94a3b8; }
.prose .toc { margin: 1.2em 0; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.prose .toc-title { margin: 0 0 6px; font-size: .75rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.prose .toc ul { list-style: none; margin: 0; padding: 0; }
.prose .toc li { margin: .15em 0; line-height: 1.5; }
.prose .toc .toc-l2 { padding-left: 1em; } .prose .toc .toc-l3 { padding-left: 2em; font-size: .94em; }
.prose .toc a { text-decoration: none; }
.heading-alias { display: block; height: 0; width: 0; overflow: hidden; }

/* ---------- public reader (MatsView) ---------- */

.reader { background: var(--surface); min-height: 100dvh; overflow-x: clip; }
.reader-bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 84%, transparent); backdrop-filter: saturate(1.5) blur(16px); -webkit-backdrop-filter: saturate(1.5) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); transition: transform .28s var(--ease);
}
.reader-bar.tucked { transform: translateY(-100%); }
.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .08s linear; }
.site .brand::before, .reader .brand::before { content: '▤'; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: .9rem; }
.reader .brand { font-size: 0; gap: 9px; }
.reader main { view-transition-name: doc-window; }
.reader .brand b { font-size: 1rem; margin: 0; }
.reader-actions { display: flex; align-items: center; gap: 6px; }
.reader .badge { font-size: .75rem; color: var(--ink-3); padding: 4px 8px; border-radius: 6px; background: var(--surface-2); white-space: nowrap; margin-right: 4px; }
.reader-bar .button { min-height: 36px; padding: 6px 12px; font-size: .8125rem; gap: 6px; }
.reader-bar .icon-btn { min-height: 36px; min-width: 36px; }
#theme-toggle .ico:last-child { display: none; }
#theme-toggle[data-mode="dark"] .ico:first-child { display: none; }
#theme-toggle[data-mode="dark"] .ico:last-child { display: inline; }
.rs-btn span { font-weight: 750; font-size: .95rem; letter-spacing: -.02em; }
.rs-wrap { position: relative; }
.read-settings {
  position: absolute; right: 0; top: calc(100% + 8px); width: 264px; padding: 12px; display: grid; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); animation: pop .14s var(--ease);
}
.rs-row { display: grid; gap: 6px; }
.rs-label { font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.read-settings .seg { display: flex; }
.read-settings .seg button { flex: 1; }
.rs-s { font-size: .75rem !important; } .rs-m { font-size: .9rem !important; } .rs-l { font-size: 1.05rem !important; } .rs-xl { font-size: 1.2rem !important; }
.rs-serif { font-family: var(--serif); font-size: .9rem !important; }

.reader main { max-width: 760px; margin: 0 auto; padding: clamp(32px, 7vw, 72px) max(20px, env(safe-area-inset-right)) 96px max(20px, env(safe-area-inset-left)); }
.reader main > h1 { font-size: clamp(2rem, 5.4vw, 2.9rem); letter-spacing: -.035em; line-height: 1.12; margin: 0 0 12px; overflow-wrap: anywhere; text-wrap: balance; }
.read-meta { margin: 0 0 36px; color: var(--ink-3); font-size: .9rem; }
.reader .prose { max-width: none; font-size: var(--read-size); line-height: 1.78; color: color-mix(in srgb, var(--ink) 92%, var(--surface)); }
.reader .plain { max-width: none; font-size: calc(var(--read-size) * .9); line-height: 1.75; }
.reader .prose p, .reader .prose li { text-wrap: pretty; }
.reader .prose h1, .reader .prose h2, .reader .prose h3 { text-wrap: balance; color: var(--ink); }
.reader .prose h2 { margin-top: 1.9em; }
.reader .prose p { margin: 0 0 1.05em; }
.reader .prose > p:first-of-type { font-size: 1.06em; }
.reader .prose img { cursor: zoom-in; }
:root[data-read-font="serif"] .reader .prose, :root[data-read-font="serif"] .reader main > h1, :root[data-read-font="serif"] .preview-pane .prose { font-family: var(--serif); }
:root[data-read-font="serif"] .reader .prose { line-height: 1.72; }
.binary-reader .binary-main { max-width: none; padding: 20px clamp(14px, 3vw, 36px) 40px; }
.binary-reader .binary-main > h1 { font-size: 1.6rem; margin-bottom: 6px; }
.binary-reader .read-meta { margin-bottom: 16px; }
.binary-actions { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.pdf-frame { width: 100%; height: calc(100dvh - 200px); min-height: 60vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.binary-reader .oo-host { height: calc(100dvh - 200px); min-height: 480px; border-radius: 12px; overflow: hidden; }
.reader-scroll { scroll-behavior: smooth; }

.to-top {
  position: fixed; z-index: 15; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom));
  width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-pop); color: var(--ink-2);
  animation: pop .2s var(--ease);
}
.to-top .ico { width: 20px; height: 20px; }

.lightbox { max-width: 96vw; width: auto; max-height: 96dvh; padding: 0; border: 0; background: transparent; box-shadow: none; overflow: visible; cursor: zoom-out; }
.lightbox::backdrop { background: rgba(4, 8, 14, .86); backdrop-filter: blur(6px); }
.lightbox img { display: block; max-width: 96vw; max-height: 88dvh; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.lightbox p { margin: 10px 0 0; text-align: center; color: #e7ecf2; font-size: .9rem; }
.lightbox p:empty { display: none; }

/* readable cards for wide text tables (reader.js) */
.table-cards { margin: 1.6em 0; }
.reader .table-cards { width: min(1160px, calc(100vw - 32px)); position: relative; left: 50%; transform: translateX(-50%); }
.tc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tc-title { margin: 0; font-size: 1.05rem; font-weight: 750; letter-spacing: -.01em; color: var(--ink); }
.tc-toggle button { min-height: 28px; padding: 3px 12px; }
.tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.tc-card {
  display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  box-shadow: var(--shadow-sm); font-size: calc(var(--read-size) * .92); line-height: 1.7;
}
.tc-top { display: flex; align-items: center; gap: 14px; }
.tc-avatar { width: 64px; height: 64px; flex: none; border-radius: 50%; overflow: hidden; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); }
.tc-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; margin: 0 !important; max-height: none !important; border-radius: 0 !important; cursor: zoom-in; display: block; }
.tc-initials { display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 40%, var(--surface))); }
.tc-name { margin: 0 !important; font-size: 1.15rem !important; letter-spacing: -.02em; line-height: 1.25; }
.tc-label { margin: 6px 0 -4px !important; font-size: .7rem !important; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.tc-text > :first-child { margin-top: 0; } .tc-text > :last-child { margin-bottom: 0; }
.tc-text img { max-width: 100%; border-radius: 10px; }
.table-wrap.is-heavy td, .table-wrap.is-heavy th { min-width: 15rem; }
.table-wrap { scrollbar-width: thin; }

/* comments on public pages */
.comments { max-width: 780px; margin: 56px auto 0; padding-top: 28px; border-top: 1px solid var(--line); }
.binary-reader .comments { padding-left: 4px; padding-right: 4px; }
.comments h2 { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; letter-spacing: -.02em; margin: 0 0 16px; }
.comments-count { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: .8rem; }
.comments-empty { color: var(--ink-3); margin: 0 0 18px; }
.comment-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 12px; }
.comment { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.comment p { margin: 8px 0 0 34px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.comment-form { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.comment-form h3 { margin: 0 0 12px; font-size: 1rem; }
.comment-fields { display: grid; gap: 12px; }
.comment-form label { display: grid; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.comment-form input, .comment-form textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; background: var(--surface); color: var(--ink); font-size: 1rem; font-weight: 400; outline: 0; resize: vertical;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.comment-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.comment-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.comment-note { margin: 0; font-size: .8125rem; color: var(--ink-3); }
.comment-msg { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; font-size: .875rem; background: var(--ok-soft); color: var(--ok); }
.comment-msg.is-error { background: var(--danger-soft); color: var(--danger); }

/* sign-in notice */
.notice { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.notice main { max-width: 460px; }
.notice h1 { margin: 40px 0 12px; font-size: clamp(2rem, 7vw, 2.75rem); letter-spacing: -.04em; line-height: 1.1; }
.notice p { line-height: 1.7; color: var(--ink-2); margin: 0 0 28px; }
.notice .brand b { margin-left: 6px; }
.interface-copyright { padding: 0 20px 20px; color: var(--ink-2); font-size: 11px; line-height: 1.4; text-align: center; }
.notice .interface-copyright { padding: 28px 0 0; text-align: left; }

/* ---------- public landing (MatsView) ---------- */

.site {
  min-height: 100dvh; display: flex; flex-direction: column; overflow-x: clip;
  background: radial-gradient(1100px 520px at 50% -160px, var(--accent-soft), transparent 72%), var(--bg);
}
.site-bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(1.5) blur(16px); -webkit-backdrop-filter: saturate(1.5) blur(16px);
}
.site .brand b { font-size: 1rem; }
.site-actions { display: flex; align-items: center; gap: 8px; }
.site-search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--ink-3); }
.site-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.site-search input { width: min(220px, 34vw); border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .9rem; }

.site-main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: clamp(28px, 6vw, 72px) max(16px, env(safe-area-inset-right)) 64px max(16px, env(safe-area-inset-left)); }
.site-hero { max-width: 640px; margin: 0 auto clamp(32px, 5vw, 56px); text-align: center; }
.eyebrow { margin: 0 0 12px; font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.site-hero h1 { margin: 0 0 14px; font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.05; letter-spacing: -.045em; text-wrap: balance; }
.lead { margin: 0 auto; max-width: 34em; color: var(--ink-2); font-size: clamp(1rem, 2.2vw, 1.125rem); line-height: 1.65; text-wrap: pretty; }
.site-count { display: inline-block; margin: 20px 0 0; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-3); font-size: .8125rem; }
.site-empty { margin: 48px 0; text-align: center; color: var(--ink-3); }

/* Each document is a little window: title bar, a live preview of the page, then what it is. */
.win-grid {
  --n: 3; list-style: none; margin: 0 auto; padding: 0; display: grid; gap: clamp(18px, 2.4vw, 28px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  max-width: min(100%, calc(var(--n) * 400px + (var(--n) - 1) * 28px));
}
.win {
  position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  box-shadow: var(--shadow-sm), 0 14px 32px -22px rgba(16, 32, 52, .35);
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .28s;
  animation: win-in .55s var(--ease) both; animation-delay: calc(min(var(--i), 8) * 70ms);
}
@keyframes win-in { from { opacity: 0; transform: translateY(16px) scale(.985); } }
.win:has(.win-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.win-bar { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.win-dots { display: flex; gap: 6px; flex: none; }
.win-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); transition: background .25s; }
.win-addr {
  flex: 1; min-width: 0; margin-right: 42px; padding: 2px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink-3); font-size: .7rem;
}
.win-addr b { font-weight: 600; color: var(--ink-2); }
.win-view { --s: .5; --pan: 0px; position: relative; aspect-ratio: 16 / 11; overflow: hidden; background: var(--surface); pointer-events: none; user-select: none; }
.win-view::after { content: ''; position: absolute; inset: auto 0 0 0; height: 36%; background: linear-gradient(to bottom, transparent, var(--surface)); }
.win-page {
  position: absolute; top: 0; left: 0; width: 760px; padding: 48px 52px 0; transform-origin: 0 0; transform: scale(var(--s));
  transition: transform .8s var(--ease);
}
.win-page > h1 { margin: 0 0 10px; font-size: 2.6rem; line-height: 1.12; letter-spacing: -.035em; text-wrap: balance; }
.win-page .read-meta { margin-bottom: 30px; }
.win-page .prose { max-width: none; font-size: 1.125rem; line-height: 1.78; }
.win-page .plain { max-width: none; white-space: pre-wrap; font-family: var(--mono); font-size: 1rem; line-height: 1.75; }
.win-info { display: grid; gap: 8px; padding: 16px 18px 18px; border-top: 1px solid var(--line); }
.win-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0; color: var(--ink-3); font-size: .78rem; }
.fmt { margin-right: 4px; padding: 2px 6px; border-radius: 5px; color: var(--c, var(--ink-2)); background: color-mix(in srgb, var(--c, var(--ink-3)) 12%, transparent); font-size: .66rem; font-weight: 800; letter-spacing: .06em; }
.win-info h2 { margin: 0; font-size: 1.15rem; line-height: 1.3; letter-spacing: -.02em; text-wrap: balance; }
.win-link { color: var(--ink); text-decoration: none; }
.win-link:focus-visible { outline: 0; }
.win-link::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.win-excerpt { margin: 0; color: var(--ink-2); font-size: .9rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.win-open { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; color: var(--accent); font-size: .8125rem; font-weight: 650; }
.win-open .ico { width: 15px; height: 15px; transition: transform .25s var(--ease); }
@media (hover: hover) {
  .win:hover { transform: translateY(-4px); border-color: var(--line-2); box-shadow: var(--shadow-pop); }
  .win:hover .win-dots i:nth-child(1) { background: #ff5f57; }
  .win:hover .win-dots i:nth-child(2) { background: #febc2e; }
  .win:hover .win-dots i:nth-child(3) { background: #28c840; }
  /* Scroll the preview slowly while the pointer rests on the window. */
  .win:hover .win-page { transform: translateY(var(--pan)) scale(var(--s)); transition: transform 6s cubic-bezier(.4, .05, .4, 1) .2s; }
  .win:hover .win-open .ico { transform: translate(2px, -2px); }
}
.win-page.is-file .file-sheet { display: grid; gap: 8px; width: 440px; margin: 10px auto 0; padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.file-sheet b { color: var(--c, var(--ink-2)); font-size: 2.4rem; letter-spacing: .02em; }
.file-sheet span { color: var(--ink-2); font-size: 1rem; overflow-wrap: anywhere; }
.file-lines { display: grid; gap: 12px; margin-top: 14px; }
.file-lines i { height: 10px; border-radius: 5px; background: var(--line); }
.file-lines i:nth-child(3n) { width: 64%; }
.site-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px; padding: 8px 16px max(22px, env(safe-area-inset-bottom)); }
.site-foot .interface-copyright { padding: 0; }
.site-foot a { color: var(--ink-3); font-size: 11px; }

/* The window that was clicked grows into the reader page (see head(): @view-transition). */
::view-transition-group(doc-window) { animation-duration: .42s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
::view-transition-old(doc-window), ::view-transition-new(doc-window) { height: 100%; object-fit: cover; object-position: top; }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 244px minmax(0, 1fr); }
  .stage.with-panel { grid-template-columns: minmax(0, 1fr) 290px; }
  .stage[data-view="split"].with-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 290px; }
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(320px, 86vw); transform: translateX(-102%);
    transition: transform .22s var(--ease); box-shadow: var(--shadow-pop);
  }
  .sidebar.shown { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(8, 18, 32, .4); animation: fade .2s; }
  @keyframes fade { from { opacity: 0; } }
  #menu { display: inline-flex; margin-left: -8px; }
  .only-narrow { display: inline-flex !important; }
  .wide-only { display: none !important; }
  .stage[data-view="split"] { grid-template-columns: minmax(0, 1fr); }
  .stage.with-panel, .stage[data-view="split"].with-panel { grid-template-columns: minmax(0, 1fr); }
  .side-panel {
    position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; max-height: 72dvh; border: 1px solid var(--line); border-bottom: 0;
    border-radius: 18px 18px 0 0; box-shadow: var(--shadow-pop); padding-bottom: env(safe-area-inset-bottom); animation: sheet .22s var(--ease);
  }
  @keyframes sheet { from { transform: translateY(24px); opacity: 0; } }
  .panel-head::before { content: ''; position: absolute; left: 50%; top: 6px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--line-2); }
  .panel-head { position: relative; padding-top: 16px; }
}

@media (max-width: 640px) {
  /* Two rows: menu + title, then view / comments / share / more. */
  .topbar { flex-wrap: wrap; gap: 4px 8px; padding-left: 14px; padding-right: 10px; padding-bottom: 8px; min-height: 0; }
  .title-wrap { flex: 1 1 calc(100% - 60px); }
  .top-actions { flex: 1 1 100%; }
  .view-seg { margin-right: auto; }
  /* The whole type bar becomes one swipeable strip. */
  .typebar { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .typebar::-webkit-scrollbar { display: none; }
  .tools, .tools-main { flex: none; overflow: visible; mask-image: none; -webkit-mask-image: none; }
  .tools-right { padding-right: 6px; }
  #title { font-size: 1.02rem; }
  .meta-line .privacy { display: none; }
  .view-seg button { padding: 4px 9px; }
  #share { padding: 6px 12px; min-height: 34px; }
  .comments-btn { padding: 6px 8px; min-height: 34px; }
  .typebar { padding: 6px 10px; gap: 6px; min-height: 48px; }
  .type-switch button { padding: 4px 7px; }
  .tool-select { min-width: 104px; }
  .type-fixed { flex-wrap: wrap; row-gap: 6px; }
  .type-fixed > span:nth-child(2) { white-space: normal; font-size: .8rem; }
  .type-actions { margin-left: 0; }
  .findbar { padding: 8px 10px; }
  .findbar input:not([type=checkbox]) { width: 100%; max-width: none; flex: 1; }
  .find-row { width: 100%; }
  textarea#body, .preview-pane { padding: 22px 18px 40vh; }
  textarea#body { font-size: 16px; } /* 16px stops iOS from zooming on focus */
  textarea#body.font-serif { font-size: 17px; }
  .statusbar { padding-left: 14px; padding-right: 14px; }
  dialog { width: 100%; max-width: 100% !important; margin: auto 0 0; border-radius: 20px 20px 0 0; padding: 22px 18px max(18px, env(safe-area-inset-bottom)); max-height: 92dvh; overflow: auto; }
  dialog[open] { animation: sheet .22s var(--ease); }
  dialog input:not([type=checkbox]), dialog select { font-size: 16px; }
  .dialog-actions .btn { flex: 1; }
  .link-row { flex-direction: column; }
  .reader .badge { display: none; }
  .reader-bar .button span { display: none; }
  .reader-bar .button { min-width: 36px; padding: 6px 8px; }
  .reader main { padding-top: 28px; }
  .read-meta { margin-bottom: 26px; }
  .tc-card { padding: 16px; }
  .tc-avatar { width: 56px; height: 56px; }
  :root { --read-size: 1.0625rem; }
  :root[data-read-size="s"] { --read-size: .95rem; }
  :root[data-read-size="l"] { --read-size: 1.1875rem; }
  :root[data-read-size="xl"] { --read-size: 1.3125rem; }
  .comment p { margin-left: 0; }
  .comment-actions .button { width: 100%; }
  .prose { font-size: 1.02rem; }
  .prose h1 { font-size: 1.65rem; } .prose h2 { font-size: 1.32rem; }
}

@media (hover: none) {
  .tool, .icon-btn { min-height: 40px; min-width: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- print ---------- */

@media print {
  @page { margin: .55in .5in; }
  :root {
    color-scheme: light;
    --ink: #000; --ink-2: #222; --ink-3: #444;
    --surface: #fff; --surface-2: #f4f4f4; --line: #999; --bg: #fff;
    --read-size: 10.5pt;
  }
  html, body { background: #fff !important; color: #000 !important; overflow: visible !important; height: auto !important; }
  /* Chrome / chrome-adjacent: bars, dialogs, comments, card toggle, eye/meta clutter */
  .sidebar, .scrim, .topbar, .typebar, .findbar, .statusbar, #error, .side-panel, dialog, .pop-menu,
  .reader-bar, .read-progress, .read-settings, .to-top, .tc-toggle, .tc-head,
  .comment-form, .comments, .binary-actions, #empty, .lightbox,
  .read-meta, .view-count { display: none !important; }
  /* On-screen card layout is for reading; print the real tables */
  .table-cards { display: none !important; }
  .table-wrap[hidden] { display: block !important; }
  .workspace, .editor, .stage, .reader-scroll, .binary-main { display: block !important; height: auto !important; min-height: 0 !important; overflow: visible !important; }
  .pane, .preview-pane, .binary-pane { position: static !important; height: auto !important; overflow: visible !important; padding: 0 !important; background: #fff !important; }
  .edit-pane[hidden], .preview-pane[hidden], #pdf-pane[hidden], #oo-pane[hidden] { display: none !important; }
  textarea#body:not([hidden]) { display: block !important; height: auto !important; min-height: 100vh; padding: 0 !important; color: #000 !important; white-space: pre-wrap !important; overflow: visible !important; }
  .title-block { margin: 0 0 10pt; gap: 4pt 10pt; }
  .title-block h1 { font-size: 18pt; color: #000; }
  .title-meta .pub-stamp { font-size: 9pt; color: #333 !important; font-weight: 500; }
  .reader main, .binary-reader main { padding: 0 !important; max-width: none !important; width: auto !important; }
  .prose, .plain { max-width: none !important; width: auto !important; font-size: 10pt; line-height: 1.35; color: #000; }
  .prose h1 { font-size: 14pt; } .prose h2 { font-size: 12pt; } .prose h3 { font-size: 11pt; }
  .prose h1, .prose h2, .prose h3, .prose h4 { break-after: avoid-page; break-inside: avoid; color: #000; }
  .prose pre, .prose .callout { break-inside: avoid; }
  /* Tables: fit page, print borders, avoid splitting a row; allow table to span pages */
  .prose .table-wrap {
    overflow: visible !important; margin: 8pt 0 12pt; border: 0; border-radius: 0;
    width: 100% !important; max-width: none !important; left: auto !important; transform: none !important; position: static !important;
  }
  .prose .table-wrap.is-heavy td, .prose .table-wrap.is-heavy th { min-width: 0 !important; }
  .prose table {
    width: 100% !important; max-width: 100% !important; table-layout: fixed;
    border-collapse: collapse; break-inside: auto; font-size: 8.5pt; line-height: 1.25;
  }
  .prose thead { display: table-header-group; }
  .prose tr { break-inside: avoid; break-after: auto; }
  .prose th, .prose td {
    border: 0.4pt solid #666 !important; padding: 3pt 4pt !important;
    vertical-align: top; overflow-wrap: anywhere; word-break: break-word;
    background: #fff !important; color: #000 !important; min-width: 0 !important;
  }
  .prose th { font-weight: 700; background: #eee !important; }
  .prose td img, .prose th img, .prose img {
    max-width: 100% !important; width: auto !important; height: auto !important;
    max-height: 0.85in !important; display: block; margin: 2pt auto !important;
    border-radius: 0 !important; break-inside: avoid; page-break-inside: avoid;
  }
  /* Compact cards if a page somehow still shows them */
  .tc-grid { display: block !important; gap: 0; }
  .tc-card { break-inside: avoid; box-shadow: none; border: 0.4pt solid #666; border-radius: 0; padding: 6pt; margin: 0 0 6pt; font-size: 9pt; line-height: 1.3; }
  .tc-avatar { width: 36pt; height: 36pt; }
  a { color: #000 !important; text-decoration: none !important; }
  a[href^="http"]::after { content: none; }
}

dialog.table-pick-dialog{max-width:min(520px,calc(100% - 24px))}
.table-pick-list{display:flex;flex-direction:column;gap:8px;margin:12px 0;max-height:min(50vh,360px);overflow:auto}
.table-pick-item{text-align:left;padding:12px 14px;border:1px solid var(--line);border-radius:8px;background:#fff;cursor:pointer;font-size:.9rem;line-height:1.35}
.table-pick-item:hover{background:#eef5ff;border-color:#b7d0f5}

.pub-stamp{color:var(--ink-3);font-weight:500;font-size:.75rem}
.pub-stamp.is-edited{color:var(--warn,#9a3412);font-weight:600}
.title-block{display:flex;flex-wrap:wrap;align-items:baseline;gap:10px 14px;margin:0 0 8px}
.title-block h1{margin:0}
.reader .title-block .pub-stamp,.binary-reader .title-block .pub-stamp{font-size:.95rem;font-weight:550;color:var(--ink-3)}
.reader .title-block .pub-stamp.is-edited,.binary-reader .title-block .pub-stamp.is-edited{color:var(--warn,#9a3412)}
#publish.is-published{border-color:#86efac;background:#f0fdf4;color:#166534}

.view-count{display:inline-flex;align-items:center;gap:3px;color:var(--ink-3);font-weight:400;font-size:.75rem;font-variant-numeric:tabular-nums;opacity:.72}
.reader .read-meta .view-count,.binary-reader .read-meta .view-count{font-size:.72rem;font-weight:400;opacity:.65}
.meta-line .view-count{opacity:.8}
.title-meta{display:inline-flex;flex-wrap:wrap;align-items:center;gap:10px}
#doc-publish.is-published{border-color:#86efac;background:#f0fdf4;color:#166534}


/* ---------- analytics board ---------- */
.analytics-btn .ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.analytics-dialog { width: min(920px, 96vw); max-height: min(88dvh, 900px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
.analytics-dialog::backdrop { background: rgba(8, 18, 32, .45); }
.analytics-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.analytics-head h2 { margin: 0 0 4px; font-size: 1.15rem; letter-spacing: -.02em; }
.analytics-head .small { margin: 0; max-width: 52ch; }
.analytics-body { padding: 16px 18px 22px; overflow: auto; max-height: calc(88dvh - 88px); display: grid; gap: 18px; }
.an-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.an-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.an-card-k { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.an-card-v { font-size: 1.45rem; font-weight: 800; letter-spacing: -.03em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.an-card-h { font-size: .75rem; color: var(--ink-3); line-height: 1.35; }
.an-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.an-chart { padding: 12px 14px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.an-chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.an-chart h3 { margin: 0; font-size: .85rem; }
.an-chart-total { font-size: .75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.an-spark { display: flex; align-items: flex-end; gap: 4px; height: 60px; padding: 4px 0; }
.an-bar { flex: 1; min-width: 0; border-radius: 4px 4px 2px 2px; background: var(--accent); opacity: .85; }
.an-axis { display: flex; justify-content: space-between; font-size: .7rem; color: var(--ink-3); margin-top: 4px; }
.an-table-wrap h3 { margin: 0 0 8px; font-size: .85rem; }
.an-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.an-table th, .an-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.an-table th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; }
.an-table td:nth-child(2), .an-table td:nth-child(3), .an-table td:nth-child(4),
.an-table th:nth-child(2), .an-table th:nth-child(3), .an-table th:nth-child(4) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-doc-meta { color: var(--ink-3); font-size: .75rem; margin-top: 2px; }
.an-table a { color: var(--accent); text-decoration: none; font-weight: 600; }
.an-table a:hover { text-decoration: underline; }
@media (max-width: 720px) {
  .an-cards, .an-charts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .an-cards, .an-charts { grid-template-columns: 1fr; }
}

/* Young West Orange's supplied artwork and local context. */
.site, .reader { --accent: #17513a; --accent-hover: #123b29; --accent-soft: #e6efe8; --accent-line: #b9d0be; }
html[data-theme="dark"] .site, html[data-theme="dark"] .reader { --accent: #82c29a; --accent-hover: #a1d2b2; --accent-soft: #153328; --accent-line: #2f5d42; }
.site-brand-logo { width: 72px; height: 48px; object-fit: contain; flex-shrink: 0; }
.reader-brand-logo { width: 54px; height: 36px; object-fit: contain; }
.site-hero-branded { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); align-items: center; gap: 36px; max-width: none; text-align: left; margin-bottom: clamp(48px, 7vw, 84px); }
.site-hero-branded h1 { font-size: clamp(2rem, 3.6vw, 3.1rem); line-height: 1.1; }
.site-hero-branded h1 span { color: var(--accent); }
.site-hero-branded .lead { margin-bottom: 16px; }
.site-intro-note { color: var(--ink-2); line-height: 1.7; max-width: 55ch; margin: 0 0 24px; }
.site-browse-link { display: inline-flex; gap: 18px; align-items: center; border-radius: 999px; padding: 12px 20px; background: #123b29; color: #fff8df; text-decoration: none; font-weight: 700; }
.site-browse-link:focus-visible { outline: 3px solid #d8b03e; outline-offset: 4px; }
.site-logo-panel { padding: 20px 6px; border-radius: 32px; background: radial-gradient(ellipse, #e2e8c4 0, transparent 70%); }
.site-hero-logo { display: block; width: 100%; height: auto; filter: drop-shadow(0 16px 22px rgba(11,42,24,.14)); }
.site-library { scroll-margin-top: 110px; }
.site-library-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.site-library-heading .eyebrow { margin-bottom: 7px; }
.site-library-heading h2 { font-size: clamp(1.4rem,2.5vw,1.8rem); letter-spacing: -.035em; margin: 0; }
.site-library-heading .site-count { margin: 0; text-align: right; }
.site-about { display: grid; grid-template-columns: 1fr 1.5fr; gap: 48px; margin-top: 64px; padding: 36px 0 0; border-top: 1px solid var(--line-2); }
.site-about h2 { margin: 0; font-size: 1.7rem; line-height: 1.2; letter-spacing: -.025em; }
.site-about p { color: var(--ink-2); line-height: 1.8; margin-top: 0; }
.site-about .eyebrow { color: var(--accent); }
.site-about a { color: var(--accent); font-weight: 650; }
@media (max-width: 760px) {
  .site .brand { gap: 6px; }
  .site .brand b { max-width: 105px; font-size: .82rem; line-height: 1.15; }
  .site-brand-logo { width: 48px; height: 36px; }
  .site-search { padding: 0 8px; gap: 4px; }
  .site-search input { width: min(130px, 25vw); font-size: .8rem; }
  .site-hero-branded { display: flex; flex-direction: column-reverse; gap: 24px; text-align: center; margin-bottom: 48px; }
  .site-logo-panel { width: min(100%, 390px); padding: 0; }
  .site-hero-branded h1 { font-size: clamp(1.9rem, 6.8vw, 2.8rem); }
  .site-intro-note { font-size: .95rem; }
  .site-library-heading { display: block; }
  .site-library-heading .site-count { margin-top: 12px; text-align: left; }
  .site-about { grid-template-columns: 1fr; gap: 20px; margin-top: 44px; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site, :root:not([data-theme="light"]) .reader { --accent: #82c29a; --accent-hover: #a1d2b2; --accent-soft: #153328; --accent-line: #2f5d42; }
}
@media (max-width: 500px) {
  .site .site-bar .brand b { display: none; }
  .site .site-bar .brand { flex-shrink: 0; }
}

.site .brand::before, .reader .brand::before { background: #123b29; color: #fff8df; }
