/* site.css build: 2026-10-17T12:32:49 */

:root {
  --radius: 14px;
  --app-bg: #11100e;
  --window-bg: #171512;
  --sidebar-bg: #13120f;
  --content-bg: #171512;
  --toc-bg: #141310;
  --bg: #171512;
  --bg-accent: #201c17;
  --panel: #171512;
  --panel-border: rgba(242, 230, 211, 0.13);
  --separator: rgba(242, 230, 211, 0.10);
  --surface-2: #1d1a16;
  --surface-3: #201c17;
  --hover: rgba(242, 230, 211, 0.055);
  --hover-strong: rgba(242, 230, 211, 0.10);
  --field-bg: #1c1915;
  --inline-code-bg: rgba(231, 168, 75, 0.10);
  --inline-code-text: #f0ba6d;
  --text: #f2e6d3;
  --muted: #aa9d89;
  --faint: #6f675b;
  --accent: #e7a84b;
  --accent-soft: rgba(231, 168, 75, 0.14);
  --accent-strong: #f4bd68;
  --selection: rgba(231, 168, 75, 0.24);
  --ring: rgba(244, 189, 104, 0.58);
  --danger: #ef745f;
  --danger-soft: rgba(239, 116, 95, 0.13);
  --success: #57c995;
  --code-bg: #100f0d;
  --quote-bg: #201c17;
  --quote-text: #aa9d89;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.24);
  --folder: #e7a84b;
  --file: #817667;
  --link: #efb968;
  --input-bg: #1c1915;
  --toc-hover: rgba(242, 230, 211, 0.055);
  --scroll-thumb: rgba(242, 230, 211, 0.16);
  --scroll-thumb-hover: rgba(242, 230, 211, 0.29);
  --study-highlight: rgba(89, 205, 181, 0.23);
  --study-highlight-border: #62cdb8;
  --study-comment-bg: #172522;
  --study-comment-border: rgba(98, 205, 184, 0.42);
  --table-header-bg: #252018;
  --table-row-alt: rgba(231, 168, 75, 0.07);
  --code-text: #f0f0ed;
  --code-comment: #8b8b89;
  --code-keyword: #d2b7ff;
  --code-control: #9fc0ff;
  --code-string: #a9c88f;
  --code-number: #d7b37d;
  --code-function: #9fc0ff;
  --code-type: #dfc38f;
  --code-annotation: #8fc8c1;
  --code-builtin: #8fc8c1;
  --code-operator: #bcbcb7;
  --code-variable: #ececea;
  --code-error: #e39b90;
}

:root[data-theme="studio"] {
  --app-bg: #11100e;
  --window-bg: #171512;
  --sidebar-bg: #13120f;
  --content-bg: #171512;
  --toc-bg: #141310;
  --bg: #171512;
  --bg-accent: #201c17;
  --panel: #171512;
  --panel-border: rgba(242, 230, 211, 0.13);
  --separator: rgba(242, 230, 211, 0.10);
  --surface-2: #1d1a16;
  --surface-3: #201c17;
  --hover: rgba(242, 230, 211, 0.055);
  --hover-strong: rgba(242, 230, 211, 0.10);
  --field-bg: #1c1915;
  --inline-code-bg: rgba(231, 168, 75, 0.10);
  --inline-code-text: #f0ba6d;
  --text: #f2e6d3;
  --muted: #aa9d89;
  --faint: #6f675b;
  --accent: #e7a84b;
  --accent-soft: rgba(231, 168, 75, 0.14);
  --accent-strong: #f4bd68;
  --selection: rgba(231, 168, 75, 0.24);
  --ring: rgba(244, 189, 104, 0.58);
  --danger: #ef745f;
  --danger-soft: rgba(239, 116, 95, 0.13);
  --success: #57c995;
  --code-bg: #100f0d;
  --quote-bg: #201c17;
  --quote-text: #aa9d89;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.24);
  --folder: #e7a84b;
  --file: #817667;
  --link: #efb968;
  --input-bg: #1c1915;
  --toc-hover: rgba(242, 230, 211, 0.055);
  --scroll-thumb: rgba(242, 230, 211, 0.16);
  --scroll-thumb-hover: rgba(242, 230, 211, 0.29);
  --study-highlight: rgba(89, 205, 181, 0.23);
  --study-highlight-border: #62cdb8;
  --study-comment-bg: #172522;
  --study-comment-border: rgba(98, 205, 184, 0.42);
  --table-header-bg: #252018;
  --table-row-alt: rgba(231, 168, 75, 0.07);
  --code-text: #f0f0ed;
  --code-comment: #8b8b89;
  --code-keyword: #d2b7ff;
  --code-control: #9fc0ff;
  --code-string: #a9c88f;
  --code-number: #d7b37d;
  --code-function: #9fc0ff;
  --code-type: #dfc38f;
  --code-annotation: #8fc8c1;
  --code-builtin: #8fc8c1;
  --code-operator: #bcbcb7;
  --code-variable: #ececea;
  --code-error: #e39b90;
}

:root[data-theme="light"] {
  --app-bg: #e6e7ea;
  --window-bg: #fbfcfe;
  --sidebar-bg: #f4f6f8;
  --content-bg: #fbfcfe;
  --toc-bg: #fbfcfe;
  --bg: #fbfcfe;
  --bg-accent: #f1f1f3;
  --panel: #fbfcfe;
  --panel-border: rgba(0, 0, 0, 0.10);
  --separator: rgba(0, 0, 0, 0.08);
  --surface-2: #ffffff;
  --surface-3: #f1f1f3;
  --hover: rgba(0, 0, 0, 0.05);
  --hover-strong: rgba(0, 0, 0, 0.08);
  --field-bg: rgba(0, 0, 0, 0.05);
  --inline-code-bg: rgba(0, 0, 0, 0.06);
  --inline-code-text: #b14a3a;
  --text: #202124;
  --muted: #73777e;
  --faint: #b0b4ba;
  --accent: #f5b800;
  --accent-soft: rgba(245, 184, 0, 0.16);
  --accent-strong: #9a7400;
  --selection: rgba(245, 184, 0, 0.26);
  --ring: rgba(10, 122, 255, 0.45);
  --danger: #d6392b;
  --danger-soft: rgba(214, 57, 43, 0.10);
  --success: #237b52;
  --code-bg: #edf2f8;
  --quote-bg: #fff3c4;
  --quote-text: #202124;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --folder: #ffc928;
  --file: #b6b6bb;
  --link: #0a7aff;
  --input-bg: rgba(0, 0, 0, 0.05);
  --toc-hover: rgba(0, 0, 0, 0.05);
  --scroll-thumb: rgba(0, 0, 0, 0.18);
  --scroll-thumb-hover: rgba(0, 0, 0, 0.30);
  --study-highlight: #fff0ad;
  --study-highlight-border: #c89b21;
  --study-comment-bg: #fffdf3;
  --study-comment-border: rgba(200, 155, 33, 0.36);
  --table-header-bg: #f3f4f6;
  --table-row-alt: #f8f9fb;
  --code-text: #2d3b50;
  --code-comment: #73777e;
  --code-keyword: #8c52ff;
  --code-control: #8c52ff;
  --code-string: #bd5526;
  --code-number: #bd5526;
  --code-function: #197f84;
  --code-type: #197f84;
  --code-annotation: #197f84;
  --code-builtin: #197f84;
  --code-operator: #475569;
  --code-variable: #2d3b50;
  --code-error: #b64427;
}

:root[data-theme="dark"] {
  --app-bg: #000000;
  --window-bg: #1c1c1e;
  --sidebar-bg: #232325;
  --content-bg: #1c1c1e;
  --toc-bg: #202022;
  --bg: #1c1c1e;
  --bg-accent: rgba(255, 255, 255, 0.05);
  --panel: #1c1c1e;
  --panel-border: rgba(255, 255, 255, 0.10);
  --separator: rgba(255, 255, 255, 0.08);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.05);
  --hover: rgba(255, 255, 255, 0.06);
  --hover-strong: rgba(255, 255, 255, 0.10);
  --field-bg: rgba(255, 255, 255, 0.08);
  --inline-code-bg: rgba(255, 255, 255, 0.08);
  --inline-code-text: #ff9b9b;
  --text: #f5f5f7;
  --muted: #98989d;
  --faint: #6e6e73;
  --accent: #ffd60a;
  --accent-soft: rgba(255, 214, 10, 0.16);
  --accent-strong: #ffd60a;
  --selection: rgba(255, 214, 10, 0.22);
  --ring: rgba(10, 132, 255, 0.6);
  --danger: #ff5a4d;
  --danger-soft: rgba(255, 90, 77, 0.16);
  --success: #57c995;
  --code-bg: #2b2b2e;
  --quote-bg: rgba(255, 255, 255, 0.05);
  --quote-text: #98989d;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --folder: #ffd60a;
  --file: #8e8e93;
  --link: #0a84ff;
  --input-bg: rgba(255, 255, 255, 0.08);
  --toc-hover: rgba(255, 255, 255, 0.06);
  --scroll-thumb: rgba(255, 255, 255, 0.16);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.28);
  --study-highlight: rgba(255, 211, 73, 0.25);
  --study-highlight-border: #e5b82f;
  --study-comment-bg: #302a18;
  --study-comment-border: rgba(229, 184, 47, 0.42);
  --table-header-bg: #29292b;
  --table-row-alt: rgba(255, 255, 255, 0.045);
  --code-text: #f0f0ed;
  --code-comment: #8b8b89;
  --code-keyword: #d2b7ff;
  --code-control: #9fc0ff;
  --code-string: #a9c88f;
  --code-number: #d7b37d;
  --code-function: #9fc0ff;
  --code-type: #dfc38f;
  --code-annotation: #8fc8c1;
  --code-builtin: #8fc8c1;
  --code-operator: #bcbcb7;
  --code-variable: #ececea;
  --code-error: #e39b90;
}

:root[data-theme="sepia"] {
  --app-bg: #ddd1ba;
  --window-bg: #f7eedb;
  --sidebar-bg: #efe4cb;
  --content-bg: #f8f0de;
  --toc-bg: #f2e7cf;
  --bg: #f7eedb;
  --bg-accent: #efe2c7;
  --panel: #f7eedb;
  --panel-border: rgba(96, 72, 36, 0.20);
  --separator: rgba(96, 72, 36, 0.15);
  --surface-2: #fcf4e2;
  --surface-3: #efe2c7;
  --hover: rgba(120, 90, 40, 0.08);
  --hover-strong: rgba(120, 90, 40, 0.13);
  --field-bg: rgba(120, 90, 40, 0.09);
  --inline-code-bg: rgba(120, 90, 40, 0.12);
  --inline-code-text: #9a4f24;
  --text: #4b3a26;
  --muted: #8a7757;
  --faint: #b3a07c;
  --accent: #bb7a2c;
  --accent-soft: rgba(187, 122, 44, 0.16);
  --accent-strong: #8a521b;
  --selection: rgba(187, 122, 44, 0.24);
  --ring: rgba(10, 122, 255, 0.45);
  --danger: #d6392b;
  --danger-soft: rgba(214, 57, 43, 0.10);
  --success: #237b52;
  --code-bg: #eee1c8;
  --quote-bg: #f4dfb3;
  --quote-text: #4b3a26;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --folder: #c4892f;
  --file: #aa9871;
  --link: #9a5a20;
  --input-bg: rgba(120, 90, 40, 0.09);
  --toc-hover: rgba(120, 90, 40, 0.08);
  --scroll-thumb: rgba(96, 72, 36, 0.24);
  --scroll-thumb-hover: rgba(96, 72, 36, 0.36);
  --study-highlight: #f1d8a6;
  --study-highlight-border: #a97635;
  --study-comment-bg: #fff7e7;
  --study-comment-border: rgba(169, 118, 53, 0.34);
  --table-header-bg: #eee0c5;
  --table-row-alt: #f4e9d4;
  --code-text: #513e2b;
  --code-comment: #957e60;
  --code-keyword: #7c4d1e;
  --code-control: #875a1f;
  --code-string: #567044;
  --code-number: #a46325;
  --code-function: #765126;
  --code-type: #8a5d2c;
  --code-annotation: #59705a;
  --code-builtin: #59705a;
  --code-operator: #765f44;
  --code-variable: #513e2b;
  --code-error: #a44032;
}

:root[data-theme="monokai"] {
  --app-bg: #171814;
  --window-bg: #272822;
  --sidebar-bg: #1f201b;
  --content-bg: #272822;
  --toc-bg: #23241f;
  --bg: #272822;
  --bg-accent: #23241f;
  --panel: #272822;
  --panel-border: #46473e;
  --separator: #3b3c34;
  --surface-2: #2f3029;
  --surface-3: #23241f;
  --hover: rgba(166, 226, 46, 0.07);
  --hover-strong: rgba(166, 226, 46, 0.12);
  --field-bg: #2f3029;
  --inline-code-bg: #3a3b33;
  --inline-code-text: #f92672;
  --text: #f8f8f2;
  --muted: #a6a69c;
  --faint: #75715e;
  --accent: #a6e22e;
  --accent-soft: rgba(166, 226, 46, 0.14);
  --accent-strong: #a6e22e;
  --selection: rgba(73, 72, 62, 0.92);
  --ring: rgba(166, 226, 46, 0.50);
  --danger: #ff5a4d;
  --danger-soft: rgba(255, 90, 77, 0.16);
  --success: #57c995;
  --code-bg: #1e1f1c;
  --quote-bg: #23241f;
  --quote-text: #a6a69c;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --folder: #e6db74;
  --file: #75715e;
  --link: #66d9ef;
  --input-bg: #2f3029;
  --toc-hover: rgba(166, 226, 46, 0.07);
  --scroll-thumb: rgba(248, 248, 242, 0.16);
  --scroll-thumb-hover: rgba(248, 248, 242, 0.28);
  --study-highlight: rgba(166, 226, 46, 0.17);
  --study-highlight-border: #9fd52c;
  --study-comment-bg: #2d3224;
  --study-comment-border: rgba(159, 213, 44, 0.40);
  --table-header-bg: #35362e;
  --table-row-alt: #2d2e27;
  --code-text: #f0f0ed;
  --code-comment: #8b8b89;
  --code-keyword: #d2b7ff;
  --code-control: #9fc0ff;
  --code-string: #a9c88f;
  --code-number: #d7b37d;
  --code-function: #9fc0ff;
  --code-type: #dfc38f;
  --code-annotation: #8fc8c1;
  --code-builtin: #8fc8c1;
  --code-operator: #bcbcb7;
  --code-variable: #ececea;
  --code-error: #e39b90;
}

:root[data-theme="one-dark"] {
  --app-bg: #081019;
  --window-bg: #081019;
  --sidebar-bg: #0b1520;
  --content-bg: #081019;
  --toc-bg: #0d1824;
  --bg: #081019;
  --bg-accent: #112031;
  --panel: #0d1824;
  --panel-border: #25384d;
  --separator: #25384d;
  --surface-2: #0d1824;
  --surface-3: #112031;
  --hover: rgba(216, 156, 60, 0.06);
  --hover-strong: rgba(216, 156, 60, 0.12);
  --field-bg: #0d1824;
  --inline-code-bg: #16314e;
  --inline-code-text: #a8d8ff;
  --text: #edf3f8;
  --muted: #9bb0c4;
  --faint: #687e93;
  --accent: #d89c3c;
  --accent-soft: rgba(216, 156, 60, 0.14);
  --accent-strong: #f6c86c;
  --selection: rgba(216, 156, 60, 0.22);
  --ring: rgba(246, 200, 108, 0.55);
  --danger: #ff5a4d;
  --danger-soft: rgba(255, 90, 77, 0.16);
  --success: #57c995;
  --code-bg: #091521;
  --quote-bg: rgba(110, 188, 255, 0.08);
  --quote-text: #c8d7e4;
  --shadow: none;
  --shadow-sm: none;
  --folder: #f6c86c;
  --file: #7890a6;
  --link: #6ebcff;
  --input-bg: #0d1824;
  --toc-hover: rgba(216, 156, 60, 0.06);
  --scroll-thumb: rgba(155, 176, 196, 0.22);
  --scroll-thumb-hover: rgba(155, 176, 196, 0.38);
  --study-highlight: rgba(246, 200, 108, 0.26);
  --study-highlight-border: #f6c86c;
  --study-comment-bg: #112031;
  --study-comment-border: rgba(110, 188, 255, 0.38);
  --table-header-bg: #11263a;
  --table-row-alt: rgba(110, 188, 255, 0.055);
  --code-text: #dce8f2;
  --code-comment: #7890a6;
  --code-keyword: #9fcbff;
  --code-control: #6ebcff;
  --code-string: #74e3b0;
  --code-number: #f6c86c;
  --code-function: #8fc8ff;
  --code-type: #f6c86c;
  --code-annotation: #9bd7d0;
  --code-builtin: #9bd7d0;
  --code-operator: #b9c9d8;
  --code-variable: #edf3f8;
  --code-error: #ff9f8f;
}

/* ==== 00-tokens.css — Shared design and layout tokens. ==== */

:root {
  /* Typography: theme-independent families and the small shared type scale. */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-ui-detailed: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --font-mono-core: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  --type-size-body: 15px;
  --type-size-default: 1rem;
  --type-size-meta: 0.8rem;
  --type-size-label: 0.7rem;

  /* Spacing primitives used across shared controls and component gaps. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-tight: 0.42rem;
  --space-compact: 0.45rem;
  --space-control: 0.55rem;
  --space-comfortable: 0.6rem;

  /* Layout measures. --sidebar-width is also the documented runtime preference
     hook; reader.js may override it after validating the saved user setting. */
  --sidebar-width: 300px;
  --layout-shell-max: 1500px;
  --layout-shell-gutters: 2rem;
  --layout-toc-min: 218px;
  --layout-toc-max: 258px;
  --measure-reader: 70rem;
  --measure-reader-wide: 72rem;

  /* Shape and border tokens. Theme palette values (separator, panel-border,
     ring, accent-soft) are generated by themes.py before these rules. */
  --radius-compact: 6px;
  --radius-control: 10px;
  --radius-popover: 12px;
  --radius-shell: 16px;
  --radius-large: 18px;
  --radius-pill: 999px;
  --radius-circle: 50%;
  --border-divider: 1px solid var(--separator);
  --border-surface: 1px solid var(--panel-border);
  --focus-outline: 2px solid var(--ring);
  --focus-shadow: 0 0 0 3px var(--accent-soft);
  --focus-shadow-tight: 0 0 0 2px var(--accent-soft);

  /* Shared elevation presets. Theme-level shadows remain in themes.py. */
  --elevation-context-menu: 0 12px 28px rgba(0, 0, 0, 0.35);

  /* Stacking order. Values preserve the historical cascade exactly;
     introduce new tiers between existing ones instead of renumbering. */
  --z-below: -1;
  --z-content: 1;
  --z-row: 2;
  --z-row-top: 3;
  --z-controls: 20;
  --z-flag: 24;
  --z-menu: 25;
  --z-drag: 35;
  --z-handle: 38;
  --z-hover: 40;
  --z-panel: 42;
  --z-panel-top: 44;
  --z-header: 50;
  --z-tip: 55;
  --z-overlay: 60;
  --z-popover: 70;
  --z-popover-top: 80;
  --z-popover-max: 90;
  --z-sticky: 120;
  --z-modal: 160;
  --z-toast: 170;
  --z-progress: 1000;
  --z-lightbox: 1100;
}

/* ==== 01-base.css — Base: reset, body, links, navigation progress bar. ==== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: var(--font-ui-detailed);
  font-size: var(--type-size-body);
  -webkit-font-smoothing: antialiased;
  background: var(--app-bg);
}

body.lightbox-open {
  overflow: hidden;
}

.navigation-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: var(--z-progress);
  height: 2px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.navigation-progress::after {
  content: "";
  display: block;
  width: 32%;
  height: 100%;
  background: var(--accent-strong);
  transform: translateX(-120%);
}

.navigation-progress.is-active {
  opacity: 1;
}

.navigation-progress.is-active::after {
  animation: navigation-progress 760ms ease-in-out infinite;
}

@keyframes navigation-progress {
  to { transform: translateX(430%); }
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

/* ==== 02-navigation.css — App chrome: layout grid, sidebar, tree, settings menu. ==== */

.layout {
  width: min(var(--layout-shell-max), calc(100vw - var(--layout-shell-gutters)));
  height: calc(100vh - 2rem);
  margin: 1rem auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  background: var(--window-bg);
  border: var(--border-surface);
  border-radius: var(--radius-shell);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: grid-template-columns 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.layout.has-toc {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) minmax(var(--layout-toc-min), var(--layout-toc-max));
}

.layout.cards-layout {
  width: min(var(--layout-shell-max), calc(100vw - var(--layout-shell-gutters)));
}

.layout.folder-open-layout {
  width: min(var(--layout-shell-max), calc(100vw - var(--layout-shell-gutters)));
}

.panel {
  background: var(--panel);
  border: var(--border-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.layout > .panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.toc-panel-empty {
  visibility: hidden;
  pointer-events: none;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.sidebar {
  min-width: 0;
  padding: 0.85rem 0.72rem 1.08rem;
  height: 100%;
  overflow: auto;
  background: var(--sidebar-bg);
  border-right: var(--border-divider);
  transition: opacity 160ms ease, padding 180ms ease;
}

.sidebar-top {
  position: sticky;
  top: -0.85rem;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0.42rem 0.56rem 0;
  background: var(--sidebar-bg);
}

.mobile-nav-toggle {
  display: none;
}

.sidebar-brand {
  display: grid;
  gap: 0.14rem;
  min-width: 0;
}

.sidebar-top-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: var(--space-compact);
}

.sidebar-brand .brand-heading {
  margin: 0;
  font-size: 1.68rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.workspace-settings-toggle {
  display: inline-grid;
  flex: 0 0 auto;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  padding: 0;
  border: var(--border-surface);
  border-radius: var(--radius-popover);
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.workspace-settings-toggle:hover,
.workspace-settings-toggle:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: none;
  transform: translateY(-1px);
}

.workspace-settings-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

.workspace-settings-toggle[hidden] {
  display: none;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-link:hover {
  color: var(--text);
}

.sidebar-brand p {
  margin: 0.22rem 0 0.68rem;
  color: var(--muted);
  font-size: 0.81rem;
  line-height: 1.45;
  max-width: none;
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
}

/* Narrow rail (collapsed or editor layout): subtitle is dead weight. */
:root[data-sidebar="collapsed"] .sidebar-brand p:not(.brand-heading) {
  display: none;
}

:root[data-sidebar="collapsed"] .workspace-settings-toggle {
  display: none;
}

.floating-controls {
  position: fixed;
  top: 1.6rem;
  right: 1.6rem;
  z-index: var(--z-header);
  padding: 0.14rem;
  border-radius: var(--radius-popover);
  box-shadow: var(--shadow-sm);
}

.back-to-top {
  position: fixed;
  right: calc(max(1rem, (100vw - 1500px) / 2) + 1rem);
  bottom: 1.35rem;
  z-index: var(--z-drag);
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  padding: 0;
  border: var(--border-surface);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.45rem);
  transition: opacity 160ms ease, transform 160ms ease, color 160ms ease, border-color 160ms ease;
}

body:has(.toc-panel:not(.toc-panel-empty)) .back-to-top {
  right: calc(max(1rem, (100vw - 1500px) / 2) + 17rem);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover,
.back-to-top:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.back-to-top svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

:root[data-view="focus"] .back-to-top {
  right: 1.35rem;
}

.edge-hover-zone {
  display: none;
}

.sidebar-resizer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: calc(var(--sidebar-width) - 3px);
  z-index: var(--z-panel);
  width: 6px;
  cursor: col-resize;
  touch-action: none;
}

.sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 140ms ease;
}

.sidebar-resizer:hover::after,
.sidebar-resizer:focus-visible::after,
body.sidebar-resizing .sidebar-resizer::after {
  opacity: 0.72;
}

body.sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

body.sidebar-resizing .layout {
  transition: none;
}

.sidebar-collapse-toggle {
  position: fixed;
  top: 50%;
  left: calc(var(--sidebar-width) - 9px);
  z-index: var(--z-panel-top);
  width: 18px;
  height: 30px;
  padding: 0;
  transform: translateY(-50%);
  border: var(--border-divider);
  border-radius: var(--radius-compact);
  background: var(--sidebar-bg);
  color: var(--muted);
  cursor: pointer;
  font-size: var(--type-size-label);
  line-height: 1;
  opacity: 0.62;
  transition: opacity 140ms ease, border-color 140ms ease, color 140ms ease;
}

.sidebar-collapse-toggle:hover,
.sidebar-collapse-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  opacity: 1;
}

.settings-shell {
  position: relative;
  isolation: isolate;
}

.control-button {
  width: 36px;
  height: 36px;
  border: var(--border-surface);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.control-button:hover,
.control-button[aria-expanded="true"] {
  background: var(--accent-soft);
}

.settings-toggle-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.settings-toggle-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  width: min(286px, calc(100vw - 1.5rem));
  padding: 0.55rem;
  display: grid;
  gap: 0;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  transform-origin: top right;
}

.settings-menu[hidden] {
  display: none;
}

/* The launcher can live inside a scrollable panel, but its popover is a
   viewport layer. This keeps display settings above every app surface rather
   than letting the TOC clip it. */
.settings-menu.settings-menu-overlay {
  position: fixed;
  inset: auto;
  z-index: var(--z-lightbox);
  transform-origin: top right;
}

.settings-menu.settings-menu-overlay::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--panel);
  transform: rotate(45deg);
  z-index: var(--z-below);
}

.settings-menu.settings-menu-overlay.settings-menu-opens-left::before {
  top: 13px;
  right: -6px;
  border-top: var(--border-surface);
  border-right: var(--border-surface);
}

.settings-menu.settings-menu-overlay:not(.settings-menu-opens-left)::before {
  top: -6px;
  right: 14px;
  border-top: var(--border-surface);
  border-left: var(--border-surface);
}

.settings-disclosure {
  border-top: var(--border-surface);
}

.settings-menu > .settings-disclosure:first-child {
  border-top: 0;
}

.settings-disclosure > summary {
  min-height: 42px;
  padding: 0.62rem 0.46rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--text);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-ui);
}

.settings-disclosure > summary::-webkit-details-marker {
  display: none;
}

.settings-disclosure > summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--type-size-default);
  line-height: 1;
}

.settings-disclosure[open] > summary::after {
  content: "−";
}

.settings-disclosure-title {
  font-size: 0.82rem;
  font-weight: 700;
}

.settings-disclosure-value {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
}

.settings-disclosure-body {
  display: grid;
  gap: 0.16rem;
  padding: 0 0 0.48rem;
}

.settings-standalone {
  padding-top: 0.42rem;
  border-top: var(--border-surface);
}

.settings-option {
  width: 100%;
  padding: 0.68rem 0.74rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-ui);
  transition: background 160ms ease, border-color 160ms ease;
}

.settings-option:hover,
.settings-option.is-active {
  background: var(--accent-soft);
}

.settings-option.is-active {
  border-color: var(--panel-border);
}

.settings-menu {
  max-height: calc(100vh - 4rem);
  overflow: auto;
}

.theme-choice {
  gap: var(--space-comfortable);
}

.theme-choice.is-active .settings-option-title {
  font-weight: 700;
  color: var(--accent-strong);
}

.font-choice {
  min-height: 38px;
  padding-top: 0.48rem;
  padding-bottom: 0.48rem;
}

.font-choice[data-font-id="serif"] .settings-option-title { font-family: Charter, "Iowan Old Style", Georgia, serif; }
.font-choice[data-font-id="georgia"] .settings-option-title { font-family: Georgia, "Times New Roman", serif; }
.font-choice[data-font-id="palatino"] .settings-option-title { font-family: "Palatino Linotype", Palatino, Georgia, serif; }
.font-choice[data-font-id="sans"] .settings-option-title { font-family: var(--font-ui); }
.font-choice[data-font-id="claude"] .settings-option-title { font-family: "Anthropic Sans", Avenir, "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.font-choice[data-font-id="medium"] .settings-option-title { font-family: sohne, "Helvetica Neue", Helvetica, Arial, sans-serif; }
.font-choice[data-font-id="avenir"] .settings-option-title { font-family: Avenir, "Avenir Next", "Segoe UI", sans-serif; }
.font-choice[data-font-id="mono"] .settings-option-title { font-family: var(--font-mono-core); }

.font-choice::after,
.alignment-choice::after {
  content: "";
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border: 1px solid var(--faint);
  border-radius: var(--radius-circle);
}

.font-choice.is-active::after,
.alignment-choice.is-active::after {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  box-shadow: var(--focus-shadow);
}

.theme-swatch {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 24px;
  border-radius: 7px;
  border: var(--border-surface);
  background: var(--sw-window);
  overflow: hidden;
}

.theme-swatch::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 13px;
  background: var(--sw-sidebar);
  border-right: var(--border-surface);
}

.theme-swatch::after {
  content: "";
  position: absolute;
  right: 5px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: var(--radius-pill);
  background: var(--sw-accent);
}

.settings-option-copy {
  display: grid;
  gap: 0.14rem;
}

.settings-option-title {
  font-size: 0.88rem;
  font-weight: 600;
}

.settings-option-state {
  font-size: 0.76rem;
  color: var(--muted);
}

.reading-width-switch {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  border: var(--border-divider);
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  transition: background 160ms ease, border-color 160ms ease;
}

.reading-width-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-circle);
  background: var(--muted);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), background 160ms ease;
}

#view-toggle.is-active .reading-width-switch {
  border-color: var(--accent);
  background: var(--accent-soft);
}

#view-toggle.is-active .reading-width-switch span {
  transform: translateX(16px);
  background: var(--accent-strong);
}

.search-shell {
  position: relative;
  margin: 1.45rem 0.56rem 0;
}

.search-shell input {
  width: 100%;
  padding: 0.56rem 0.76rem;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--field-bg);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
}

.search-shell input::placeholder {
  color: var(--faint);
}

.search-shell input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent);
}

.nav-pills {
  display: flex;
  gap: 0.4rem;
  margin: 0.82rem 0.56rem 0;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  padding: 0.4rem 0.72rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 140ms ease, color 140ms ease;
}

.nav-pill:hover {
  color: var(--text);
  background: var(--hover);
}

.nav-pill.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 600;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-compact);
  margin: 0.78rem 0.56rem 0;
}

.sidebar-actions[hidden] {
  display: none !important;
}

.sidebar-create-action {
  min-width: 0;
  padding: 0.5rem 0.45rem;
  font-size: 0.76rem;
  white-space: nowrap;
}

.action-button,
.action-link,
.action-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.56rem 0.86rem;
  border-radius: var(--radius-popover);
  border: var(--border-surface);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  line-height: 1;
}

.action-button:hover,
.action-link:hover {
  background: var(--accent-soft);
}

.action-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.action-danger:hover {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
}

.action-button[hidden],
.action-link[hidden],
.action-danger[hidden] {
  display: none;
}

.folder-dialog {
  width: min(30rem, calc(100vw - 2rem));
  padding: 0;
  border: var(--border-surface);
  border-radius: var(--radius-shell);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.folder-dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(2px);
}

.folder-form {
  display: grid;
  gap: var(--space-4);
  padding: 1.2rem;
}

.folder-dialog-copy h2,
.folder-dialog-copy p {
  margin: 0;
}

.folder-dialog-copy h2 {
  margin-top: 0.25rem;
  font-size: 1.3rem;
}

.folder-dialog-copy p {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.folder-field {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.folder-field input {
  width: 100%;
  padding: 0.72rem 0.78rem;
  border: var(--border-surface);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  color: var(--text);
  font: 0.9rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  outline: none;
}

.folder-field input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-shadow);
}

.folder-field textarea {
  width: 100%;
  padding: 0.72rem 0.78rem;
  border: var(--border-surface);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  color: var(--text);
  font: 0.9rem/1.45 var(--font-ui);
  outline: none;
  resize: vertical;
}

.folder-field textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-shadow);
}

.lock-password-field {
  position: relative;
}

.lock-password-field .lock-password-input {
  padding-right: 2.4rem;
}

.lock-password-mode {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: fit-content;
  color: var(--text);
  font-size: 0.84rem;
  cursor: pointer;
}

.lock-password-mode input {
  appearance: none;
  inline-size: 1rem;
  block-size: 1rem;
  display: grid;
  place-content: center;
  margin: 0;
  border: var(--border-surface);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--surface-3);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.lock-password-mode input::after {
  content: "";
  inline-size: 0.46rem;
  block-size: 0.24rem;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  opacity: 0;
  transform: rotate(-45deg) translate(0.04rem, -0.06rem);
}

.lock-password-mode:hover input {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.lock-password-mode input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.lock-password-mode input:checked::after {
  opacity: 1;
}

.lock-password-mode input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-shadow);
}

.folder-field small {
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 450;
  line-height: 1.4;
}

.workspace-settings-dialog .folder-form {
  gap: 0.9rem;
}

.workspace-password-state {
  display: grid;
  gap: 0.18rem;
  padding: 0.72rem 0.8rem;
  border: var(--border-divider);
  border-radius: var(--radius-control);
  background: var(--surface-2);
}

.workspace-password-state strong {
  font-size: 0.84rem;
}

.workspace-password-state span {
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.42;
}

.workspace-settings-dialog .folder-dialog-actions {
  justify-content: space-between;
}

.workspace-settings-route {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.8rem 0;
  border: 0;
  border-top: var(--border-divider);
  border-bottom: var(--border-divider);
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  text-align: left;
  cursor: pointer;
}

.workspace-settings-route:hover,
.workspace-settings-route:focus-visible {
  color: var(--accent-strong);
  outline: none;
}

.workspace-settings-route-copy {
  display: grid;
  gap: 0.18rem;
}

.workspace-settings-route strong {
  font-size: 0.9rem;
}

.workspace-settings-route small {
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.4;
}

.workspace-settings-route-arrow {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 1.25rem;
  line-height: 1;
}

.workspace-password-editor[hidden] {
  display: none;
}

.workspace-settings-dialog [data-privacy-actions][hidden] {
  display: none;
}

.workspace-settings-dialog .workspace-password-state[hidden],
.workspace-settings-dialog .workspace-settings-route[hidden] {
  display: none;
}

.workspace-password-editor .folder-dialog-actions {
  justify-content: flex-end;
  margin-top: 0.6rem;
}

.lock-password-credential[hidden] {
  display: none;
}

.lock-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-compact);
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.lock-password-toggle:hover,
.lock-password-toggle:focus-visible {
  color: var(--text);
  background: var(--hover-strong);
  outline: none;
}

.lock-password-toggle svg {
  width: 15px;
  height: 15px;
}

.folder-dialog-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
}

.folder-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-control);
}

.lock-progress {
  display: grid;
  gap: var(--space-compact);
}

.lock-progress-count {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 650;
}

.lock-progress-track {
  width: 100%;
  height: 0.5rem;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--accent);
}

.lock-progress-track::-webkit-progress-bar {
  background: var(--surface-2);
}

.lock-progress-track::-webkit-progress-value {
  background: var(--accent);
}

.lock-progress-track::-moz-progress-bar {
  background: var(--accent);
}

.lock-progress-note {
  min-height: 1.2em;
  overflow: hidden;
  color: var(--faint);
  font: 0.76rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-create-button {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 650;
}

.folder-create-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.source-label {
  color: var(--faint);
  font-size: var(--type-size-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tree-header {
  margin: 1rem 0.62rem 0;
  padding-top: 0.76rem;
  border-top: var(--border-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-control);
}

.tree-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.tree-action {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.tree-action:hover {
  border-color: var(--panel-border);
  background: var(--surface-2);
  color: var(--text);
}

.tree-action svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tree-action .tree-action-expand-icon {
  display: none;
}

.tree-action.is-expand .tree-action-collapse-icon {
  display: none;
}

.tree-action.is-expand .tree-action-expand-icon {
  display: block;
}

.tree-wrap {
  margin-top: 0.68rem;
}

.tree-section {
  margin-bottom: 0.9rem;
}

.tree-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 0.3rem;
  padding: 0 0.6rem;
  color: var(--faint);
  font-size: var(--type-size-label);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tree {
  display: block;
}

.tree-folder {
  display: block;
}

.tree-children {
  display: block;
}

.tree-row {
  position: relative;
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.38rem 0.6rem;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: inherit;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease;
}

.tree-folder-row {
  justify-content: flex-start;
}

.tree-row:hover {
  background: var(--hover);
}

.tree-row.active {
  background: var(--selection);
  box-shadow: none;
}

.tree-row.active .tree-label,
.tree-row.active .tree-folder-label {
  font-weight: 600;
}

.tree-row:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 1px;
}

.tree-lock-badge {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-left: auto;
  display: grid;
  place-items: center;
  color: var(--faint);
  opacity: 0.75;
}

.tree-lock-badge svg {
  width: 100%;
  height: 100%;
}

.tree-folder-lock-badge {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-left: auto;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  opacity: 0.95;
}

.tree-folder-lock-badge svg {
  width: 100%;
  height: 100%;
}

.tree-folder-lock-badge + .tree-drag-handle {
  margin-left: 0.22rem;
}

.tree-folder.is-locked > .tree-folder-row {
  cursor: pointer;
}

.tree-folder.is-locked > .tree-folder-row .tree-toggle {
  visibility: hidden;
  pointer-events: none;
}

.tree-drag-handle {
  flex: 0 0 auto;
  width: 22px;
  height: 24px;
  margin-left: auto;
  padding: 4px 5px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-compact);
  background: transparent;
  color: var(--faint);
  cursor: grab;
  opacity: 0;
  transition: color 120ms ease, opacity 120ms ease, background 120ms ease;
}

/* A locked editable row has two related controls. Keep them as one compact
   endpoint instead of spending the row's remaining space between them. */
.tree-lock-badge + .tree-drag-handle {
  margin-left: 0.22rem;
}

.tree-drag-handle svg {
  width: 10px;
  height: 14px;
  fill: currentColor;
}

.tree-row:hover .tree-drag-handle,
.tree-row:focus-within .tree-drag-handle,
.tree-drag-handle:focus-visible,
body.tree-dragging .tree-drag-handle {
  opacity: 1;
}

.tree-drag-handle:hover,
.tree-drag-handle:focus-visible {
  background: var(--hover-strong);
  color: var(--text);
  outline: none;
}

.tree-drag-handle:active {
  cursor: grabbing;
}

.tree-item-menu {
  position: fixed;
  z-index: var(--z-modal);
  width: min(15.5rem, calc(100vw - 1rem));
  padding: 0.35rem;
  border: var(--border-surface);
  border-radius: var(--radius-control);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tree-item-menu-title {
  overflow: hidden;
  padding: 0.38rem 0.52rem 0.45rem;
  color: var(--faint);
  font-size: var(--type-size-label);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tree-item-menu-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-comfortable);
  padding: 0.48rem 0.52rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: var(--type-size-meta);
  text-align: left;
}

.tree-item-menu-action-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  color: var(--faint);
}

.tree-item-menu-action-icon svg {
  width: 100%;
  height: 100%;
}

.tree-item-menu-action:hover,
.tree-item-menu-action:focus-visible {
  background: var(--hover-strong);
  outline: none;
}

.tree-item-menu-action.is-danger {
  color: var(--danger);
}

.tree-item-menu-action.is-danger:hover,
.tree-item-menu-action.is-danger:focus-visible {
  background: var(--danger-soft);
}

.tree-item-menu-divider {
  height: 1px;
  margin: 0.32rem 0.25rem;
  background: var(--separator);
}

.tree-item-dialog .folder-dialog-copy h2 {
  line-height: 1.3;
}

.tree-trash-undo {
  position: fixed;
  z-index: var(--z-toast);
  right: 1rem;
  bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 0.54rem 0.62rem 0.54rem 0.76rem;
  border: var(--border-surface);
  border-radius: 9px;
  background: var(--surface-3);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.78rem;
}

.tree-trash-undo span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-trash-undo button {
  flex: 0 0 auto;
  padding: 0.28rem 0.48rem;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
}

.tree-trash-undo button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.tree-row.is-dragging {
  opacity: 0.42;
}

.tree-row.is-drop-before::before,
.tree-row.is-drop-after::after {
  content: "";
  position: absolute;
  z-index: var(--z-row);
  left: 0.55rem;
  right: 0.55rem;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--accent-strong);
  pointer-events: none;
}

.tree-row.is-drop-before::before {
  top: -1px;
}

.tree-row.is-drop-after::after {
  bottom: -1px;
}

.tree-row.is-drop-inside {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.tree-root-drop-zone {
  height: 0;
  margin: 0 0.6rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed transparent;
  border-radius: 8px;
  color: var(--faint);
  font-size: 0.72rem;
  opacity: 0;
  transition: height 120ms ease, margin 120ms ease, opacity 120ms ease;
}

body.tree-dragging .tree-root-drop-zone {
  height: 34px;
  margin-block: 0.35rem;
  border-color: var(--panel-border);
  opacity: 1;
}

.tree-root-drop-zone.is-drop-root {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

body.tree-moving .tree-drag-handle {
  pointer-events: none;
  cursor: wait;
}

.tree-move-status {
  position: fixed;
  z-index: var(--z-sticky);
  left: 1rem;
  bottom: 1rem;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.48rem 0.7rem;
  border: var(--border-surface);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.tree-move-status.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.tree-move-status[data-state="error"] {
  color: var(--danger);
}

@media (hover: none) {
  .tree-drag-handle {
    opacity: 1;
  }
}

.tree-spacer {
  flex: 0 0 auto;
  height: 1px;
}

.tree-toggle {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.tree-toggle:hover {
  background: var(--hover-strong);
}

.tree-toggle:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 1px;
}

.tree-chevron {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--muted);
  transition: transform 120ms ease;
}

.tree-folder.open > .tree-row .tree-chevron {
  transform: rotate(90deg);
}

.tree-icon {
  flex: 0 0 auto;
}

.tree-icon.folder {
  position: relative;
  width: 13px;
  height: 10px;
  border-radius: 2px;
  background: var(--folder);
}

.tree-icon.folder::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -3px;
  width: 6px;
  height: 4px;
  border-radius: 2px 2px 0 0;
  background: color-mix(in srgb, var(--folder) 85%, white);
}

/* A solid-filled document shape (folded top-right corner + two "text
   line" cutouts) — the previous version was a thin unfilled outline at
   11x13px, which read as a stray box rather than a file icon, especially
   next to the folder icon's solid colored fill. */
.tree-icon.file {
  position: relative;
  width: 11px;
  height: 13px;
  border-radius: 1px 3px 1px 1px;
  background: var(--file);
  clip-path: polygon(0 0, 65% 0, 100% 35%, 100% 100%, 0 100%);
}

.tree-icon.file::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 5px;
  height: 5px;
  background: color-mix(in srgb, var(--file) 55%, white);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.tree-icon.file::after {
  content: "";
  position: absolute;
  left: 2.5px;
  top: 7px;
  width: 6px;
  height: 1px;
  background: var(--panel);
  box-shadow: 0 3px 0 var(--panel);
}

.tree-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.tree-folder-label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 auto;
}

.tree-empty {
  padding: 0.9rem 0.2rem 0;
  color: var(--muted);
  font-size: 0.84rem;
}

/* ==== 03-reader.css — Reading view: content panel, note body, alerts, One Dark surface overrides. ==== */

/* Medium-paywall-style gate: a decorative (fake — there is no real plaintext
   at build time, see README "Locked Notes") blurred backdrop that fills the
   whole reading area, with a big lock icon + password field floating over it
   — no dialog chrome, no card border. */
.locked-note-gate {
  position: relative;
  min-height: 34rem;
  overflow: hidden;
  border-radius: 0.5rem;
}

.locked-note-backdrop {
  filter: blur(7px);
  opacity: 0.55;
  user-select: none;
  pointer-events: none;
  padding: 0 1rem;
}

/* Set synchronously in <head>, before <body> paints, when this note was
   already decrypted earlier this session — hides the blurred placeholder for
   the one frame before lock-view.js's async decrypt swaps in real content.
   lock-view.js removes the .locked-note-gate class (real content) or the
   data-note-prehidden attribute (cached key turned out invalid) either way. */
:root[data-note-prehidden="true"] .locked-note-gate {
  visibility: hidden;
}

.locked-note-backdrop h2,
.locked-note-backdrop h3 {
  height: 1.4rem;
  margin: 1.6rem 0 1rem;
  background: var(--separator);
  border-radius: 0.3rem;
  max-width: 55%;
}

.locked-note-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(to bottom, transparent, var(--content-bg) 78%);
}

.locked-note-prompt {
  width: 100%;
  max-width: 20rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
}

.locked-note-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 0.4rem;
  color: var(--text);
  opacity: 0.85;
}

.locked-note-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 1;
}

.locked-note-heading {
  margin: 0 0 0.5rem;
  font-weight: 650;
  color: var(--text);
}

.locked-note-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-comfortable);
}

.locked-note-form .lock-password-input {
  width: 100%;
  padding: 0.65rem 2.4rem 0.65rem 0.9rem;
  border: var(--border-surface);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

.locked-note-form .lock-password-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-shadow);
}

.locked-note-submit {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: var(--border-surface);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.locked-note-submit:hover {
  background: var(--accent-soft);
}

.locked-note-hint {
  font-size: var(--type-size-meta);
  opacity: 0.75;
  margin: 0.5rem 0 0;
  text-align: center;
}


.content-panel {
  min-width: 0;
  padding: clamp(1.28rem, 2.15vw, 2.3rem);
  height: 100%;
  overflow: auto;
  background: var(--content-bg);
}

.content-header {
  position: relative;
  isolation: isolate;
  margin-bottom: 1.25rem;
  padding: 0.16rem 0 1rem;
  border-bottom: var(--border-divider);
  overflow: hidden;
}

.content-header::before,
.folder-hero::before {
  content: "";
  position: absolute;
  inset: -0.85rem 0 0;
  z-index: var(--z-below);
  pointer-events: none;
  opacity: 0.28;
  background-image: linear-gradient(to right, var(--separator) 1px, transparent 1px), linear-gradient(to bottom, var(--separator) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to right, #000 0%, #000 44%, transparent 94%);
}

.content-panel > .content-header,
.content-panel > .note-body {
  width: min(100%, var(--measure-reader));
  margin-left: auto;
  margin-right: auto;
}

.content-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.content-header-tools {
  margin-left: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.content-header h1 {
  margin: 0.55rem 0 0;
  font-size: clamp(1.82rem, 3.05vw, 2.55rem);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.06;
}

.content-header p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  max-width: 44rem;
  line-height: 1.6;
}

.content-header .note-description {
  font-style: italic;
  color: var(--muted);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-compact);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-family: var(--font-ui);
}

.back-link:visited,
.back-link:hover,
.back-link:active {
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent-strong);
}

.page-nav-links {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
}

.header-actions {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.note-toolbar {
  margin-top: 0;
  display: inline-flex;
  gap: var(--space-compact);
}

.icon-action,
.icon-action-danger {
  width: 38px;
  height: 38px;
  padding: 0;
  border: var(--border-surface);
  border-radius: var(--radius-popover);
  background: var(--surface-2);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  cursor: pointer;
}

.icon-action:hover {
  background: var(--accent-soft);
}

.icon-action-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.icon-action-danger:hover {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
}

.icon-action-icon {
  width: 17px;
  height: 17px;
  display: block;
}

.icon-action-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.meta-row {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-control);
}

.content-header-flags,
.note-link-flags,
.tag-note-flags,
.welcome-card-flags,
.card-note-flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-tight);
}

.content-header-flags {
  justify-content: flex-end;
  align-self: flex-start;
  margin-left: 0;
}

.meta-pill,
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.66rem;
  border-radius: var(--radius-pill);
  border: var(--border-surface);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-size: 0.83rem;
}

/* A static label (e.g. "Current", meaning "you're already looking at this
   folder") must not look like the clickable "Open" pill next to it — same
   shape read as the same affordance, and static ones do nothing on click. */
.tag-chip-static,
.tag-chip-static:hover {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  cursor: default;
}

.tag-chip:hover {
  background: var(--accent-soft);
}

.flag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.56rem;
  border-radius: var(--radius-pill);
  border: var(--border-surface);
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.flag-chip-todo {
  background: rgba(181, 116, 30, 0.12);
  color: #8c5316;
}

.flag-chip-revise {
  background: rgba(39, 101, 164, 0.12);
  color: #265b91;
}

:root[data-theme="dark"] .flag-chip {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: #ededea;
}

:root[data-theme="dark"] .flag-chip-todo {
  border-color: rgba(239, 213, 162, 0.14);
  background: rgba(191, 151, 90, 0.18);
  color: #f3d7a2;
}

:root[data-theme="dark"] .flag-chip-revise {
  border-color: rgba(209, 225, 255, 0.14);
  background: rgba(100, 137, 188, 0.18);
  color: #d6e5ff;
}

.note-body {
  line-height: 1.7;
  font-size: var(--type-size-default);
}

/* Pandoc's --mathml wraps the original TeX in an <annotation> inside every
   <math> element. MathML Core hides it, but engines without it render the
   raw LaTeX as visible text right after the equation (the leaking "\%" is
   the tell). Hide it unconditionally — same rule MathJax ships. */
.note-body math annotation {
  display: none;
}

.note-body > :first-child {
  margin-top: 0;
}

.note-body h1,
.note-body h2,
.note-body h3,
.note-body h4,
.note-body h5,
.note-body h6 {
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.012em;
}

.note-body h1 {
  margin-top: 1.5em;
  margin-bottom: 0.45em;
  font-size: 1.6rem;
}

.note-body h2 {
  margin-top: 1.55em;
  margin-bottom: 0.45em;
  font-size: 1.3rem;
}

.note-body h3 {
  margin-top: 1.3em;
  margin-bottom: 0.35em;
  font-size: 1.08rem;
}

.note-body h4 {
  margin-top: 1.2em;
  margin-bottom: 0.35em;
  font-size: 0.97rem;
}

.note-body h5,
.note-body h6 {
  margin-top: 1.15em;
  margin-bottom: 0.35em;
}

.heading-link {
  width: 1.65rem;
  height: 1.65rem;
  margin-left: 0.32rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: 0.08em;
  border: 0;
  border-radius: var(--radius-compact);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease, color 140ms ease, background-color 140ms ease;
}

.note-body h1:hover .heading-link,
.note-body h2:hover .heading-link,
.note-body h3:hover .heading-link,
.note-body h4:hover .heading-link,
.note-body h5:hover .heading-link,
.note-body h6:hover .heading-link,
.heading-link:hover,
.heading-link:focus-visible,
.heading-link.is-copied {
  opacity: 1;
}

.heading-link:hover,
.heading-link:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.heading-link:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

.heading-link.is-copied {
  color: var(--accent-strong);
}

.heading-link svg {
  width: 0.92rem;
  height: 0.92rem;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.heading-link .heading-link-check {
  display: none;
}

.heading-link.is-copied .heading-link-icon {
  display: none;
}

.heading-link.is-copied .heading-link-check {
  display: block;
}

.note-body p,
.note-body ul,
.note-body ol,
.note-body blockquote,
.note-body table {
  margin: 0.78rem 0;
}

.note-body ul,
.note-body ol {
  padding-left: 1.35rem;
}

.note-body li + li {
  margin-top: 0.3rem;
}

.note-body a {
  color: var(--link);
  overflow-wrap: anywhere;
}

.note-body img {
  display: block;
  width: auto;
  max-width: min(100%, 980px);
  height: auto;
  margin: 1.15rem auto;
  border-radius: var(--radius-popover);
  border: var(--border-divider);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
}

.note-file-attachment {
  display: grid;
  gap: 0.4rem;
  box-sizing: border-box;
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border: var(--border-surface);
  border-radius: 8px;
  background: var(--surface-2);
  max-width: 100%;
}
.note-file-attachment a {
  display: block;
  overflow-wrap: anywhere;
  font-family: var(--font-ui);
  font-weight: 600;
}
.note-file-meta {
  display: block;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
}
.note-file-attachment video {
  display: block;
  width: 100%;
  max-height: 70vh;
  background: #111;
  border-radius: var(--radius-compact);
}
.note-file-attachment.ProseMirror-selectednode {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.note-body .note-image-captioned {
  display: block;
  max-width: 100%;
  margin: 1.15rem auto;
}

.note-body .note-image-captioned img {
  width: auto;
  max-width: min(100%, 980px);
  margin: 0;
}

.note-image-caption {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding-top: 0.5rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.83rem;
  font-style: italic;
  line-height: 1.45;
  text-align: center;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-sticky);
  display: grid;
  place-items: safe center;
  padding: clamp(0.75rem, 2vw, 2rem);
  overflow: auto;
  background: rgba(12, 10, 8, 0.8);
  backdrop-filter: blur(10px);
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox-inner {
  position: relative;
  width: fit-content;
  max-width: 100%;
  max-height: calc(100dvh - 1.5rem);
}

.image-lightbox-close {
  /* The close control is its own first grid row. A small image should not
     collapse the viewer around the image and leave this button over its
     caption. */
  position: static;
  grid-row: 1;
  justify-self: end;
  z-index: var(--z-row);
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-pill);
  background: rgba(24, 20, 17, 0.75);
  color: #f6eadb;
  cursor: pointer;
}

.image-lightbox-close:hover {
  background: rgba(38, 31, 25, 0.9);
}

.image-lightbox-close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.image-lightbox-figure {
  position: relative;
  margin: 0;
  display: grid;
  gap: var(--space-3);
  justify-items: center;
  width: fit-content;
  max-width: 100%;
  max-height: calc(100dvh - 1.5rem);
}

.image-lightbox-image {
  display: block;
  max-width: min(100%, 1500px);
  /* Reserve room for the close row, caption, and optional carousel controls
     before sizing the image. Very short viewports can scroll the overlay. */
  max-height: max(0px, calc(100dvh - 14rem));
  width: auto;
  height: auto;
  border-radius: var(--radius-large);
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.42);
}

.image-lightbox-caption {
  max-width: min(90vw, 1100px);
  max-height: 4.5rem;
  overflow-y: auto;
  overflow-wrap: anywhere;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-pill);
  background: rgba(24, 20, 17, 0.72);
  color: #f6eadb;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.image-lightbox-navigation {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-pill);
  background: rgba(24, 20, 17, 0.75);
  color: #f6eadb;
}

.image-lightbox-navigation[hidden] {
  display: none;
}

.image-lightbox-arrow {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius-circle);
  background: transparent;
  color: inherit;
  font-size: 1.3rem;
  cursor: pointer;
}

.image-lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.12);
}

.image-lightbox-arrow:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.image-lightbox-position {
  min-width: 3.5rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.note-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.note-body :not(pre) > code {
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  padding: 0.12rem 0.34rem;
  border-radius: var(--radius-compact);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.note-body pre {
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-popover);
  background: var(--code-bg);
  color: var(--code-text);
  tab-size: 2;
  white-space: pre;
}

.note-body div.sourceCode {
  margin: 0.85rem 0;
  border-radius: var(--radius-popover);
  overflow: hidden;
}

.note-body div.sourceCode pre {
  margin: 0;
}

.code-block {
  position: relative;
  margin: 0.85rem 0;
}

.code-block > pre,
.code-block > div.sourceCode {
  margin: 0;
}

.code-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: var(--z-row);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.58rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.10);
  color: #f0f0ed;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.code-block:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
}

.code-copy:hover {
  background: rgba(255, 255, 255, 0.2);
}

.code-copy.is-copied {
  opacity: 1;
  color: #a9e6a0;
  border-color: rgba(169, 230, 160, 0.45);
  background: rgba(169, 230, 160, 0.16);
}

@media (hover: none) {
  .code-copy {
    opacity: 1;
  }
}

/* Light code blocks (sepia, light) need a dark-on-light button — the default
   light-on-dark styling above is unreadable against a pale code background. */
:root[data-theme="sepia"] .code-copy,
:root[data-theme="light"] .code-copy {
  border-color: var(--panel-border);
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

:root[data-theme="sepia"] .code-copy:hover,
:root[data-theme="light"] .code-copy:hover {
  background: rgba(0, 0, 0, 0.12);
}

.note-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.86em;
  overflow-wrap: normal;
  word-break: normal;
}

.note-body pre code.sourceCode,
.note-body pre code.sourceCode span {
  color: var(--code-variable);
}

.note-body pre code.sourceCode span.co,
.note-body pre code.sourceCode span.do {
  color: var(--code-comment);
  font-style: italic;
}

.note-body pre code.sourceCode span.kw,
.note-body pre code.sourceCode span.cf {
  color: var(--code-keyword);
  font-weight: 600;
}

.note-body pre code.sourceCode span.at {
  color: var(--code-annotation);
}

.note-body pre code.sourceCode span.st,
.note-body pre code.sourceCode span.ch,
.note-body pre code.sourceCode span.sc,
.note-body pre code.sourceCode span.vs {
  color: var(--code-string);
}

.note-body pre code.sourceCode span.dv,
.note-body pre code.sourceCode span.fl,
.note-body pre code.sourceCode span.bn,
.note-body pre code.sourceCode span.cn {
  color: var(--code-number);
}

.note-body pre code.sourceCode span.fu {
  color: var(--code-function);
}

.note-body pre code.sourceCode span.dt,
.note-body pre code.sourceCode span.bu,
.note-body pre code.sourceCode span.ot {
  color: var(--code-type);
}

.note-body pre code.sourceCode span.an,
.note-body pre code.sourceCode span.im,
.note-body pre code.sourceCode span.pp,
.note-body pre code.sourceCode span.in {
  color: var(--code-builtin);
}

.note-body pre code.sourceCode span.va {
  color: var(--code-variable);
}

.note-body pre code.sourceCode span.op {
  color: var(--code-operator);
}

.note-body pre code.sourceCode span.er {
  color: var(--code-error);
}

.note-body blockquote {
  padding: 0.4rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--quote-text);
  background: var(--quote-bg);
  border-radius: 0 10px 10px 0;
}

/* GitHub-compatible alerts. Pandoc recognizes the standard fence notation
   and emits .note/.tip/.important/.warning/.caution; markdown.py adds the
   stable markdown-alert hooks below. These are content blocks, not cards:
   one coloured edge, a compact icon title, then prose. */
.note-body .markdown-alert,
.editor-rich-mount .ProseMirror .markdown-alert {
  --alert-color: var(--accent);
  margin: 1rem 0;
  padding: 0.72rem 0.95rem 0.78rem 1rem;
  border: 0;
  border-left: 3px solid var(--alert-color);
  border-radius: 0 9px 9px 0;
  background: color-mix(in srgb, var(--alert-color) 11%, var(--surface-2));
  color: var(--text);
}

.note-body .markdown-alert-note,
.editor-rich-mount .ProseMirror .markdown-alert-note { --alert-color: #58aefc; }
.note-body .markdown-alert-tip,
.editor-rich-mount .ProseMirror .markdown-alert-tip { --alert-color: #57c995; }
.note-body .markdown-alert-important,
.editor-rich-mount .ProseMirror .markdown-alert-important { --alert-color: #b68cff; }
.note-body .markdown-alert-warning,
.editor-rich-mount .ProseMirror .markdown-alert-warning { --alert-color: #e9ae4e; }
.note-body .markdown-alert-caution,
.editor-rich-mount .ProseMirror .markdown-alert-caution { --alert-color: #ef7e73; }

.note-body .markdown-alert-title,
.editor-rich-mount .ProseMirror .markdown-alert-title {
  margin: 0 0 0.32rem;
  color: var(--alert-color);
  font-size: var(--type-size-meta);
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.note-body .markdown-alert-title p,
.editor-rich-mount .ProseMirror .markdown-alert-title p {
  display: flex;
  align-items: center;
  gap: var(--space-tight);
  margin: 0;
}

.note-body .markdown-alert-title p::before,
.editor-rich-mount .ProseMirror .markdown-alert-title p::before {
  content: "ⓘ";
  display: inline-grid;
  width: 1rem;
  height: 1rem;
  place-items: center;
  font-size: var(--type-size-default);
  line-height: 1;
}

.note-body .markdown-alert-tip .markdown-alert-title p::before,
.editor-rich-mount .ProseMirror .markdown-alert-tip .markdown-alert-title p::before { content: "✦"; }
.note-body .markdown-alert-important .markdown-alert-title p::before,
.editor-rich-mount .ProseMirror .markdown-alert-important .markdown-alert-title p::before { content: "◆"; font-size: 0.74rem; }
.note-body .markdown-alert-warning .markdown-alert-title p::before,
.editor-rich-mount .ProseMirror .markdown-alert-warning .markdown-alert-title p::before,
.note-body .markdown-alert-caution .markdown-alert-title p::before,
.editor-rich-mount .ProseMirror .markdown-alert-caution .markdown-alert-title p::before { content: "⚠"; }

.note-body .markdown-alert > :last-child,
.editor-rich-mount .ProseMirror .markdown-alert > :last-child { margin-bottom: 0; }

/* In rich text, alert syntax remains standard Markdown in the document but
   is decorated into the same icon/title treatment as the reader. */
.editor-rich-mount .ProseMirror blockquote.markdown-alert {
  position: relative;
  padding-top: 1.88rem;
}
.editor-rich-mount .ProseMirror blockquote.markdown-alert::before {
  content: "ⓘ " attr(data-alert-label);
  position: absolute;
  top: 0.62rem;
  left: 1rem;
  color: var(--alert-color);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.035em;
  line-height: 1;
  text-transform: uppercase;
}
.editor-rich-mount .ProseMirror blockquote.markdown-alert-tip::before { content: "✦ " attr(data-alert-label); }
.editor-rich-mount .ProseMirror blockquote.markdown-alert-important::before { content: "◆ " attr(data-alert-label); }
.editor-rich-mount .ProseMirror blockquote.markdown-alert-warning::before,
.editor-rich-mount .ProseMirror blockquote.markdown-alert-caution::before { content: "⚠ " attr(data-alert-label); }
.editor-rich-mount .ProseMirror .markdown-alert-marker { display: none; }

/* One Dark follows the Temporal reference: a deep navy canvas, a quiet blue
   structural surface, and no inherited studio grid texture. */
:root[data-theme="one-dark"] body {
  background: radial-gradient(circle at 78% 0%, #16314e 0, transparent 30%), var(--app-bg);
}

:root[data-theme="one-dark"] .content-panel,
:root[data-theme="one-dark"] .diagram-stage {
  background-image: none;
}

:root[data-theme="one-dark"] .content-header::before,
:root[data-theme="one-dark"] .folder-hero::before,
:root[data-theme="one-dark"] .home-hero::before {
  opacity: 0;
}

.note-body hr {
  border: 0;
  border-top: var(--border-surface);
  margin: 2rem 0;
}

/* ==== 04-editor-page.css — Editor page shell (local-only). ==== */

.editor-shell {
  display: grid;
  gap: var(--space-4);
}

.editor-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.editor-topbar h1 {
  margin: 0.75rem 0 0;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1;
}

.editor-topbar p {
  margin: 0.75rem 0 0;
  color: var(--muted);
  max-width: 42rem;
  line-height: 1.6;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-comfortable);
  flex-wrap: wrap;
}

.editor-more-button {
  min-width: 2.45rem;
  min-height: 2.15rem;
  padding: 0.3rem 0.52rem;
  border: var(--border-surface);
  border-radius: var(--radius-control);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font: 700 0.9rem/1 var(--font-ui);
  letter-spacing: 0.06em;
}

.editor-more-button:hover,
.editor-more-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: none;
}

.editor-annotation-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.editor-annotation-button {
  padding: 0.28rem 0.55rem;
  border: var(--border-divider);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: var(--type-size-label);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.editor-annotation-button:hover,
.editor-annotation-button:focus-visible {
  border-color: var(--study-highlight-border);
  background: var(--study-highlight);
  color: var(--text);
}

.study-note-dialog {
  width: min(31rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--study-comment-border);
  border-radius: var(--radius-shell);
  background: var(--study-comment-bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

.study-note-dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
}

.study-note-form {
  display: grid;
  gap: var(--space-4);
  padding: 1.1rem;
}

.study-note-form h2 {
  margin: 0.32rem 0 0;
  font-size: 1.35rem;
}

.study-note-form p {
  margin: 0.48rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.study-note-field {
  display: grid;
  gap: var(--space-tight);
}

.study-note-field > span {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.study-note-field textarea {
  width: 100%;
  padding: 0.72rem 0.78rem;
  border: var(--border-surface);
  border-radius: var(--radius-control);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.study-note-field textarea:focus {
  outline: var(--focus-outline);
  outline-offset: 1px;
}

.study-note-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.editor-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: var(--space-4);
  row-gap: var(--space-3);
  align-items: end;
}

.editor-field {
  display: grid;
  gap: 0.38rem;
}

.editor-field-folder {
  position: relative;
}

.editor-folder-suggestions {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  z-index: var(--z-controls);
  max-height: 14rem;
  overflow-y: auto;
  border: var(--border-surface);
  border-radius: var(--radius-popover);
  background: var(--panel);
  box-shadow: var(--elevation-context-menu);
}

.editor-folder-suggestion {
  display: block;
  width: 100%;
  padding: 0.55rem 0.82rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.editor-folder-suggestion:hover,
.editor-folder-suggestion.is-highlighted {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.editor-field span {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-input,
.editor-textarea {
  width: 100%;
  border: var(--border-surface);
  border-radius: var(--radius-shell);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
}

.editor-input {
  padding: 0.82rem 0.92rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}

select.editor-input {
  cursor: pointer;
}

.editor-input:focus,
.editor-textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 30%, transparent);
}

.editor-status {
  min-height: 1.2rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

.editor-status[data-state="error"] {
  color: var(--danger);
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  min-height: 68vh;
}

.editor-pane {
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-large);
  border: var(--border-surface);
  background: var(--surface-3);
}

.editor-pane-header {
  padding: 0.78rem 0.9rem;
  border-bottom: var(--border-surface);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-textarea {
  min-height: calc(68vh - 3.4rem);
  padding: 1rem 1.05rem;
  resize: vertical;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.65;
}

.editor-preview-frame {
  width: 100%;
  min-height: calc(68vh - 3.4rem);
  border: 0;
  background: transparent;
}

.editor-disabled {
  padding: 1rem 1.05rem;
  border-radius: var(--radius-popover);
  border: var(--border-surface);
  background: var(--danger-soft);
  color: var(--muted);
  line-height: 1.6;
}

.card-note-shell {
  display: grid;
  gap: var(--space-4);
  min-height: 0;
}

.card-note-intro {
  color: var(--muted);
  line-height: 1.7;
}

.card-note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 360px));
  gap: 0.8rem;
  max-height: min(68vh, 760px);
  overflow-y: auto;
  padding-right: 0.25rem;
  align-content: start;
  justify-content: center;
  justify-items: stretch;
  overscroll-behavior: contain;
}

.card-note-card {
  display: grid;
  gap: var(--space-4);
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  width: 100%;
  max-width: 360px;
  min-height: 250px;
  padding: 1rem 1.05rem;
  border-radius: var(--radius-large);
  border: var(--border-surface);
  background: var(--surface-2);
  overflow: hidden;
}

.card-note-link-card {
  color: inherit;
  text-decoration: none;
}

.card-note-link-card:hover {
  background: var(--accent-soft);
}

.card-note-header {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.card-note-header-top,
.note-link-header,
.tag-note-header,
.welcome-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.note-lock-badge {
  display: inline-flex;
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  color: var(--faint);
  opacity: 0.8;
  vertical-align: middle;
}

.note-lock-badge svg {
  width: 100%;
  height: 100%;
}

.card-note-header span {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-note-header strong {
  font-size: 1.02rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card-note-description {
  color: var(--text);
  line-height: 1.7;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card-note-description > :first-child {
  margin-top: 0;
}

.card-note-description > :last-child {
  margin-bottom: 0;
}

.card-note-description p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 8;
  overflow: hidden;
}

.note-body table {
  width: 100%;
  border-collapse: collapse;
  background: var(--content-bg);
}

.note-body th,
.note-body td {
  padding: 0.7rem 0.8rem;
  border: var(--border-surface);
  text-align: left;
}

mark {
  padding: 0 0.06em;
  border-radius: 2px;
  background: var(--study-highlight);
  color: inherit;
}

mark[data-comment] {
  cursor: pointer;
  border-bottom: 1px dashed var(--study-highlight-border);
}

mark[data-comment]:hover,
mark[data-comment]:focus-visible,
mark[data-comment].is-comment-open {
  outline: 2px solid var(--study-highlight-border);
  outline-offset: 2px;
}

.study-comment-popover {
  position: fixed;
  z-index: var(--z-hover);
  width: min(21rem, calc(100vw - 1.5rem));
  padding: 0.72rem 0.78rem 0.78rem;
  border: 1px solid var(--study-comment-border);
  border-radius: var(--radius-popover);
  background: var(--study-comment-bg);
  box-shadow: var(--shadow);
  color: var(--text);
}

.study-comment-popover[hidden] {
  display: none;
}

.study-comment-popover-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--type-size-label);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.study-comment-close {
  width: 1.45rem;
  height: 1.45rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-compact);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.study-comment-close:hover,
.study-comment-close:focus-visible {
  background: var(--hover);
  color: var(--text);
}

.study-comment-copy {
  margin: 0.52rem 0 0;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.5;
}

.note-body th {
  background: var(--table-header-bg);
  font-weight: 700;
}

.note-body tbody tr:nth-child(even) td {
  background: var(--table-row-alt);
}

/* ==== 05-toc-home.css — TOC panel, home hero, publish dialog. ==== */

.toc-panel {
  padding: 0.95rem 0.84rem 1rem;
  height: 100%;
  overflow: auto;
  background: var(--toc-bg);
  border-left: var(--border-divider);
}

.toc-panel h2 {
  margin: 0 0 0.1rem;
  font-size: var(--type-size-label);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc-panel p {
  margin: 0.22rem 0 0.48rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.toc-list {
  display: grid;
  gap: 0.08rem;
}

.toc-group {
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  overflow: hidden;
}

.toc-group[open] {
  background: transparent;
}

.toc-group + .toc-group,
.toc-link + .toc-group,
.toc-group + .toc-link {
  margin-top: 0.08rem;
}

.toc-group-summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-control);
  padding: 0.28rem 0.44rem;
  cursor: pointer;
  list-style: none;
}

.toc-group-summary::-webkit-details-marker {
  display: none;
}

.toc-group-summary:hover {
  background: var(--toc-hover);
}

.toc-group-summary:focus-visible,
.toc-link:focus-visible,
.toc-group-label:focus-visible,
.toc-group-anchor:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 1px;
}

.toc-group-caret {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--muted);
  transition: transform 120ms ease;
}

.toc-group[open] > .toc-group-summary .toc-group-caret {
  transform: rotate(90deg);
}

.toc-group-label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-compact);
  color: var(--text);
  font-size: 0.84rem;
  text-decoration: none;
}

.toc-group-anchor {
  flex: 0 0 auto;
  padding: 0.14rem 0.4rem;
  border-radius: var(--radius-pill);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.76rem;
}

.toc-group-anchor:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.toc-sublist {
  display: grid;
  gap: 0.08rem;
  padding: 0 0.28rem 0.28rem;
}

.toc-link {
  display: block;
  padding: 0.24rem 0.42rem;
  border-radius: var(--radius-control);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.84rem;
}

.toc-link:hover {
  background: var(--toc-hover);
  color: var(--text);
}

.toc-link.level-1 {
  margin-top: 0.3rem;
  color: var(--text);
  font-weight: 700;
}

.toc-group.level-1 {
  margin-top: 0.3rem;
}

.toc-group.level-1 > .toc-group-summary .toc-group-label {
  font-weight: 700;
}

.toc-group.level-2 {
  margin-left: 0.6rem;
}

.toc-link.level-2 {
  margin-left: 0.6rem;
}

.toc-link.level-3 {
  margin-left: 0.6rem;
}

.toc-link.level-4 {
  margin-left: 1.1rem;
}

:root[data-sidebar="collapsed"] .sidebar {
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  border-right: 0;
  opacity: 0;
  pointer-events: none;
}

:root[data-sidebar="collapsed"] .sidebar-resizer {
  display: none;
}

:root[data-sidebar="collapsed"] .sidebar-collapse-toggle {
  top: 50%;
  left: 0;
  z-index: var(--z-popover-top);
  width: 1.75rem;
  height: 2.15rem;
  border-left: 0;
  border-radius: 0 0.5rem 0.5rem 0;
  background: var(--sidebar-bg);
  box-shadow: 0 0.3rem 0.8rem color-mix(in srgb, var(--content-bg) 58%, transparent);
  color: var(--text);
  font-size: 0.9rem;
  opacity: 1;
}

/* Keep the collapsed navigation out of layout while pinning the invisible
   sidebar and content to the same cell. This preserves the full page width
   without creating an implicit second grid row. */
:root[data-sidebar="collapsed"] .layout {
  grid-template-columns: minmax(0, 1fr);
}
:root[data-sidebar="collapsed"] .layout > .sidebar {
  grid-column: 1;
  grid-row: 1;
}
:root[data-sidebar="collapsed"] .layout > .content-panel {
  grid-column: 1;
  grid-row: 1;
}

:root[data-sidebar="collapsed"] .layout.has-toc {
  grid-template-columns: minmax(0, 1fr) minmax(var(--layout-toc-min), var(--layout-toc-max));
}
:root[data-sidebar="collapsed"] .layout.has-toc > .content-panel {
  grid-column: 1;
  grid-row: 1;
}
:root[data-sidebar="collapsed"] .layout.has-toc > .toc-panel {
  grid-column: 2;
  grid-row: 1;
}

:root[data-view="focus"] .layout {
  width: min(1240px, calc(100vw - 2rem));
  grid-template-columns: minmax(0, 1fr);
}

:root[data-view="focus"] .layout.cards-layout {
  width: min(1240px, calc(100vw - 2rem));
}

:root[data-view="focus"] .layout.folder-open-layout {
  width: min(1240px, calc(100vw - 2rem));
}

:root[data-view="focus"] .layout.has-toc {
  width: min(1240px, calc(100vw - 2rem));
  grid-template-columns: minmax(0, 1fr);
}

:root[data-view="focus"] .sidebar-resizer,
:root[data-view="focus"] .sidebar-collapse-toggle {
  display: none;
}

:root[data-view="focus"] .sidebar {
  display: block;
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: 320px;
  height: auto;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  z-index: var(--z-hover);
  background: var(--sidebar-bg);
  border: var(--border-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateX(calc(-100% - 1.5rem));
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;
}

/* A tree action menu belongs to the navigation it came from. Keep that rail
   visible until the menu is dismissed so the menu never looks detached. */
:root[data-view="focus"] body.tree-item-menu-open .sidebar {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

:root[data-view="focus"] .toc-panel {
  display: block;
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 258px;
  height: auto;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  z-index: var(--z-hover);
  background: var(--toc-bg);
  border: var(--border-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 1.5rem));
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;
}

:root[data-view="focus"] .toc-panel.toc-panel-empty {
  display: none;
}

:root[data-view="focus"] .edge-hover-zone {
  position: fixed;
  top: 0;
  z-index: var(--z-handle);
  display: block;
  width: 28px;
  height: 100vh;
}

:root[data-view="focus"] .edge-hover-zone-left {
  left: 0;
}

:root[data-view="focus"] .edge-hover-zone-right {
  right: 0;
}

:root[data-view="focus"] .edge-hover-zone::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 4px;
  height: 52px;
  margin-top: -26px;
  border-radius: var(--radius-pill);
  background: var(--scroll-thumb);
  transition: opacity 160ms ease;
}

:root[data-view="focus"] .edge-hover-zone-left::after {
  left: 7px;
}

:root[data-view="focus"] .edge-hover-zone-right::after {
  right: 7px;
}

:root[data-view="focus"] .edge-hover-zone:hover::after {
  opacity: 0;
}

:root[data-view="focus"] .edge-hover-zone-left:hover ~ .layout .sidebar,
:root[data-view="focus"] .sidebar:hover,
:root[data-view="focus"] .sidebar:focus-within {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

:root[data-view="focus"] .edge-hover-zone-right:hover ~ .layout .toc-panel:not(.toc-panel-empty),
:root[data-view="focus"] .toc-panel:hover,
:root[data-view="focus"] .toc-panel:focus-within {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

:root[data-view="focus"] .content-panel {
  width: 100%;
  min-height: calc(100vh - 2rem);
  padding: clamp(1.35rem, 2vw, 2.35rem);
}

:root[data-view="focus"] .content-panel > .content-header,
:root[data-view="focus"] .content-panel > .note-body {
  /* Keep a generous but bounded reading canvas when navigation is hidden. */
  width: min(100%, 76rem);
  margin-left: auto;
  margin-right: auto;
}

:root[data-view="focus"] .content-header-top {
  align-items: center;
}

:root[data-view="focus"] .content-header-tools {
  flex: 0 0 auto;
}

:root[data-view="focus"] .content-header p {
  max-width: 52rem;
}

:root[data-view="focus"] .content-panel > .welcome,
:root[data-view="focus"] .content-panel > .folder-summary {
  width: min(100%, var(--measure-reader-wide));
  margin-left: auto;
  margin-right: auto;
}

:root[data-view="focus"] .content-panel > .card-note-shell {
  width: min(100%, var(--measure-reader-wide));
  margin-left: auto;
  margin-right: auto;
}

:root[data-view="focus"] .content-panel > .folder-open-shell {
  width: min(100%, var(--measure-reader-wide));
  margin-left: auto;
  margin-right: auto;
}

.welcome {
  display: grid;
  gap: var(--space-6);
}

.home-hero {
  position: relative;
  min-height: 238px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(1.4rem, 5vw, 4.6rem);
  padding: clamp(1.3rem, 3vw, 2.65rem) clamp(0.15rem, 1.4vw, 1rem) 1.8rem;
  overflow: hidden;
  border-bottom: var(--border-divider);
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.52;
  background-image: linear-gradient(to right, var(--separator) 1px, transparent 1px), linear-gradient(to bottom, var(--separator) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to right, #000 0%, #000 48%, transparent 92%);
}

.home-hero-copy,
.home-hero-mark {
  position: relative;
  z-index: var(--z-content);
}

.home-kicker,
.home-section-heading span:first-child {
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-hero h1 {
  margin: 0.45rem 0 0;
  font-size: clamp(3.1rem, 7vw, 5.8rem);
  line-height: 0.86;
  letter-spacing: -0.075em;
}

.home-hero p {
  max-width: 38rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: var(--type-size-default);
  line-height: 1.62;
}

.home-stat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1.35rem;
  margin: 1.3rem 0 0;
}

.home-stat {
  display: grid;
  gap: 0.08rem;
}

.home-stat strong {
  font-size: 1.08rem;
  line-height: 1;
}

.home-stat span {
  color: var(--muted);
  font-size: 0.78rem;
}

.home-publish-shell {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.home-publish-button {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.home-publish-summary {
  color: var(--muted);
  font-size: 0.76rem;
}

.publish-dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-height: min(42rem, calc(100dvh - 2rem));
  padding: 0;
  border: var(--border-surface);
  border-radius: var(--radius-shell);
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow);
}

.publish-dialog::backdrop {
  background: rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(2px);
}

.publish-form {
  display: grid;
  gap: var(--space-4);
  padding: 1.2rem;
}

.publish-dialog-copy h2,
.publish-dialog-copy p,
.publish-feedback {
  margin: 0;
}

.publish-dialog-copy h2 {
  margin-top: 0.25rem;
  font-size: 1.3rem;
}

.publish-dialog-copy p {
  margin-top: 0.45rem;
  color: var(--muted);
}

.publish-dialog-copy .publish-destination {
  font-size: var(--type-size-meta);
}

.publish-destination a {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.publish-change-shell {
  min-width: 0;
  border: var(--border-divider);
  border-radius: var(--radius-popover);
  overflow: hidden;
}

.publish-change-heading {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0.62rem 0.75rem;
  border-bottom: var(--border-divider);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.publish-change-list {
  max-height: 13rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  overflow: auto;
  list-style: none;
  font-family: var(--font-mono-core);
  font-size: 0.76rem;
  line-height: 1.65;
}

.publish-change-list li {
  overflow-wrap: anywhere;
}

.publish-change-empty {
  color: var(--muted);
  font-family: var(--font-ui);
}

.publish-message-field {
  display: grid;
  gap: var(--space-tight);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.publish-message-field input {
  width: 100%;
  padding: 0.7rem 0.78rem;
  border: var(--border-surface);
  border-radius: var(--radius-control);
  outline: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.86rem;
  letter-spacing: 0;
  text-transform: none;
}

.publish-message-field input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-shadow-tight);
}

.publish-feedback {
  min-height: 1.2em;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.45;
}

.publish-feedback[data-state="error"] {
  color: var(--danger);
}

.publish-feedback[data-state="success"] {
  color: var(--accent-strong);
}

.publish-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-control);
}

.publish-submit-button {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.publish-submit-button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.home-hero-mark {
  width: clamp(118px, 16vw, 184px);
  height: clamp(118px, 16vw, 184px);
  display: grid;
  place-items: center;
  border: var(--border-surface);
  border-radius: 30px;
  background: color-mix(in srgb, var(--accent-soft) 64%, var(--surface-2));
  box-shadow: var(--shadow-sm);
  transform: rotate(4deg);
}

.home-hero-mark img {
  width: 68%;
  height: 68%;
  display: block;
  filter: drop-shadow(0 10px 14px color-mix(in srgb, var(--accent) 22%, transparent));
}

.home-section {
  display: grid;
  gap: 0.82rem;
}

.home-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}

.home-section-heading span:last-child {
  color: var(--muted);
  font-size: 0.82rem;
}

.home-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0;
  border-top: var(--border-divider);
  border-left: var(--border-divider);
}

.home-folder-card {
  min-height: 188px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.72rem;
  padding: 1rem 1.05rem;
  border-right: var(--border-divider);
  border-bottom: var(--border-divider);
  background: var(--content-bg);
  color: inherit;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.home-folder-card:hover {
  background: var(--accent-soft);
}

.home-folder-index {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.home-folder-card strong {
  display: block;
  font-size: 1.2rem;
  line-height: 1.15;
}

.home-folder-card p {
  margin: 0.48rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.home-folder-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  color: var(--muted);
  font-size: 0.78rem;
}

.home-tags {
  display: grid;
  gap: 0.7rem;
  padding-top: 0.15rem;
}

.home-tags-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.home-tags-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.home-tags-footer .meta-row {
  margin-top: 0;
}

.home-tags-link {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.home-tags-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.welcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.78rem;
}

.welcome-card,
.tag-section {
  display: block;
  padding: 0.92rem 0.98rem;
  border-radius: var(--radius-shell);
  border: var(--border-surface);
  background: var(--surface-2);
  text-decoration: none;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.welcome-card:hover {
  background: var(--accent-soft);
}

.welcome-card strong,
.tag-note-link strong {
  display: block;
  font-size: var(--type-size-default);
}

.welcome-card-header strong,
.note-link-header strong,
.tag-note-header strong {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.welcome-card span,
.tag-note-link span {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.welcome-card-kicker {
  font-size: 0.82rem;
}

.welcome-card-path {
  font-size: var(--type-size-meta);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.welcome-card-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.welcome-tips {
  padding: 0.95rem 1rem;
  border-radius: var(--radius-shell);
  border: var(--border-surface);
  background: var(--surface-2);
}

.welcome-tips h2 {
  margin: 0 0 0.55rem;
  font-size: var(--type-size-default);
}

/* ==== 06-folder.css — Folder overview pages and boards. ==== */

.folder-hero {
  position: relative;
  isolation: isolate;
  padding: 0.2rem 0 1.3rem;
  border-bottom: var(--border-divider);
  overflow: hidden;
}

.folder-hero h1 {
  margin: 0.7rem 0 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.folder-hero p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  line-height: 1.62;
  max-width: 42rem;
}

.folder-summary {
  display: grid;
  gap: 1.18rem;
  width: min(100%, 86rem);
  margin-left: auto;
  margin-right: auto;
}

.folder-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 1fr);
  gap: 0;
  align-items: stretch;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: 0;
  margin-bottom: 0.9rem;
  border-top: var(--border-divider);
  border-left: var(--border-divider);
}

.folder-column {
  display: grid;
  gap: 0.72rem;
  align-content: start;
  min-width: 0;
  padding: 1rem 1.05rem;
  border-right: var(--border-divider);
  border-bottom: var(--border-divider);
  background: var(--content-bg);
  scroll-snap-align: start;
}

.folder-column-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
}

.folder-column-title {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.folder-column-title strong {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.folder-column-heading-link {
  color: inherit;
  text-decoration: none;
}

.folder-column-heading-link:hover { color: var(--accent-strong); }

.folder-column-title span,
.folder-note-path {
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.folder-note-list {
  display: grid;
  gap: 0.58rem;
  align-content: start;
}

/* Article-list row (Substack/Medium archive style) — plain rows separated
   by a hairline, not boxed cards: title, then a short description, then a
   small muted byline-style meta line. */
.folder-note-link,
.folder-child-link {
  display: grid;
  align-content: start;
  gap: 0.32rem;
  min-width: 0;
  padding: 1.1rem 0;
  border-bottom: var(--border-surface);
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.folder-open-grid > :last-child {
  border-bottom: none;
}

.folder-note-link:hover strong,
.folder-child-link:hover strong {
  color: var(--accent-strong);
}

.folder-note-link strong,
.folder-child-link strong {
  display: -webkit-box;
  font-family: var(--font-serif, var(--font-ui));
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.folder-note-summary,
.folder-note-link span,
.folder-child-link span {
  display: -webkit-box;
  color: var(--muted);
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.folder-note-meta,
.folder-child-meta {
  display: block;
  -webkit-line-clamp: 1;
  font-size: 0.78rem;
  line-height: 1.42;
  margin-top: 0.15rem;
}

.folder-column-empty {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.folder-open-shell {
  display: grid;
  gap: 0.9rem;
  width: min(100%, 82rem);
  margin-left: auto;
  margin-right: auto;
}

.folder-open-sections {
  display: grid;
  gap: 0.82rem;
}

.folder-board-description,
.folder-open-hero p {
  max-width: 46rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.folder-board-description {
  padding: 0.9rem clamp(1.15rem, 2.35vw, 3rem);
}

.folder-open-section {
  padding: 0.95rem 1rem;
  border-radius: var(--radius-large);
  border: var(--border-surface);
  background: var(--surface-3);
}

.folder-open-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 0.8rem;
}

.folder-open-section-title {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.folder-open-section-title strong {
  font-family: var(--font-ui);
  font-size: var(--type-size-default);
  overflow-wrap: anywhere;
}

.folder-open-section-title span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.folder-open-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.sidebar,
.toc-panel,
.tree-wrap,
.folder-grid,
.folder-note-list,
.card-note-grid {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

.sidebar::-webkit-scrollbar,
.toc-panel::-webkit-scrollbar,
.tree-wrap::-webkit-scrollbar,
.folder-grid::-webkit-scrollbar,
.folder-note-list::-webkit-scrollbar,
.card-note-grid::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.sidebar::-webkit-scrollbar-track,
.toc-panel::-webkit-scrollbar-track,
.tree-wrap::-webkit-scrollbar-track,
.folder-grid::-webkit-scrollbar-track,
.folder-note-list::-webkit-scrollbar-track,
.card-note-grid::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.toc-panel::-webkit-scrollbar-thumb,
.tree-wrap::-webkit-scrollbar-thumb,
.folder-grid::-webkit-scrollbar-thumb,
.folder-note-list::-webkit-scrollbar-thumb,
.card-note-grid::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background-clip: padding-box;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.toc-panel::-webkit-scrollbar-thumb:hover,
.tree-wrap::-webkit-scrollbar-thumb:hover,
.folder-grid::-webkit-scrollbar-thumb:hover,
.folder-note-list::-webkit-scrollbar-thumb:hover,
.card-note-grid::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  background-clip: padding-box;
}

.folder-empty {
  padding: 1rem 1.05rem;
  border-radius: var(--radius-large);
  border: var(--border-surface);
  background: var(--surface-3);
  color: var(--muted);
  line-height: 1.6;
}

.folder-locked-state {
  display: grid;
  gap: var(--space-control);
  place-items: start;
  align-content: start;
  width: min(100%, 42rem);
  padding: 0.25rem 0;
  color: var(--muted);
}

.folder-locked-state h1,
.folder-locked-state p {
  margin: 0;
}

.folder-locked-state h1 {
  color: var(--text);
  font-family: var(--font-ui);
  font-size: clamp(2rem, 4vw, 2.7rem);
  font-weight: 760;
  letter-spacing: -0.042em;
  line-height: 1.05;
}

.folder-locked-state .eyebrow {
  margin-bottom: 0.25rem;
}

.folder-locked-unlock {
  margin-top: 0.65rem;
}

.folder-page .folder-locked-shell {
  display: block;
  padding: clamp(1.8rem, 4vw, 3.25rem) clamp(1.15rem, 4vw, 4.5rem);
}

.folder-page .folder-locked-shell .folder-locked-state {
  width: min(100%, 42rem);
  margin-inline: auto;
}

body.folder-open-page .folder-open-content > .folder-locked-state {
  width: 100%;
  padding-top: 0.35rem;
}

.tag-section + .tag-section {
  margin-top: 0.85rem;
}

.tag-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.tag-count {
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.tag-note-list {
  display: grid;
  gap: 0.7rem;
}

.tag-note-link {
  display: block;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius);
  border: var(--border-surface);
  background: var(--surface-3);
  text-decoration: none;
}

.tag-note-link:hover {
  background: var(--accent-soft);
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .layout.has-toc {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) minmax(196px, 224px);
  }

  .card-note-grid {
    grid-template-columns: repeat(2, minmax(280px, 360px));
  }
}

@media (max-width: 860px) {
  .sidebar-resizer,
  .sidebar-collapse-toggle {
    display: none !important;
  }

  :root[data-sidebar="collapsed"] .layout,
  :root[data-sidebar="collapsed"] .layout.has-toc {
    grid-template-columns: 1fr;
  }

  :root[data-sidebar="collapsed"] .sidebar {
    width: 100%;
    padding: 0.55rem 0.75rem;
    overflow: visible;
    border-bottom: var(--border-divider);
    opacity: 1;
    pointer-events: auto;
  }

  .layout,
  .layout.has-toc {
    width: min(100vw - 1rem, 980px);
    height: auto;
    overflow: visible;
    grid-template-columns: 1fr;
    border-radius: var(--radius);
  }

  .sidebar,
  .content-panel,
  .toc-panel {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .sidebar {
    border-right: 0;
    border-bottom: var(--border-divider);
  }

  .toc-panel {
    border-left: 0;
    border-top: var(--border-divider);
  }

  .floating-controls {
    top: 0.75rem;
    right: 0.75rem;
  }

  .content-header-top {
    flex-wrap: wrap;
  }

  .content-header-tools {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .folder-grid {
    grid-auto-columns: minmax(84vw, 1fr);
  }

  .editor-meta,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-page .editor-grid {
    height: auto;
  }

  .editor-page .editor-textarea,
  .editor-page .editor-preview-frame {
    min-height: 60vh;
  }

  .card-note-grid {
    grid-template-columns: minmax(0, 360px);
    max-height: none;
    overflow: visible;
    padding-right: 0;
    justify-content: center;
  }

  .home-hero {
    grid-template-columns: 1fr;
    gap: 1.4rem;
  }

  .home-hero-mark {
    width: 96px;
    height: 96px;
  }

  :root[data-view="focus"] .content-panel > .content-header,
  :root[data-view="focus"] .content-panel > .note-body,
  :root[data-view="focus"] .content-panel > .welcome,
  :root[data-view="focus"] .content-panel > .folder-summary,
  :root[data-view="focus"] .content-panel > .folder-open-shell,
  :root[data-view="focus"] .content-panel > .card-note-shell {
    width: 100%;
  }

  :root[data-view="focus"] .edge-hover-zone {
    display: none;
  }

  :root[data-view="focus"] .sidebar,
  :root[data-view="focus"] .toc-panel {
    position: static;
    width: auto;
    max-height: none;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    box-shadow: none;
    border-radius: 0;
  }
}

/* -----------------------------------------------------------------------
   Learning studio: full canvas, quiet chrome, wide visual tracks
   ----------------------------------------------------------------------- */

.layout,
.layout.cards-layout,
.layout.folder-open-layout,
:root[data-view="focus"] .layout,
:root[data-view="focus"] .layout.cards-layout,
:root[data-view="focus"] .layout.folder-open-layout,
:root[data-view="focus"] .layout.has-toc {
  width: 100vw;
  height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.floating-controls {
  top: 0.72rem;
  right: 0.72rem;
}

:root[data-theme="studio"] .content-panel {
  background-color: var(--content-bg);
  background-image:
    linear-gradient(to right, rgba(242, 230, 211, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(242, 230, 211, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

:root[data-theme="studio"] .content-header::before,
:root[data-theme="studio"] .folder-hero::before {
  opacity: 0.5;
  background-size: 32px 32px;
}

.note-page .content-panel {
  padding: clamp(0.65rem, 1.1vw, 1rem) clamp(1rem, 4vw, 4.6rem) 0.9rem;
  /* Short notes left the prev/next footer floating right under the body
     instead of pinned to the bottom of the page — push it down instead. */
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.note-page .content-panel > .note-footer-nav {
  margin-top: auto;
}

.note-page .content-panel > .content-header,
:root[data-view="focus"] .note-page .content-panel > .content-header {
  width: min(100%, 46rem);
  margin: 0 auto clamp(1.6rem, 3vw, 2.4rem);
  padding: 0 0 clamp(1.3rem, 2.3vw, 1.8rem);
  border-bottom-color: color-mix(in srgb, var(--separator) 72%, var(--text));
  overflow: visible;
}

.note-page .content-header h1 {
  max-width: 44rem;
  margin-top: clamp(0.72rem, 1.4vw, 1.15rem);
  font-size: clamp(2.25rem, 3.7vw, 3.35rem);
  font-weight: 720;
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.note-meta-line {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: 1rem;
}

.note-page .content-header .note-description {
  max-width: 42rem;
  margin: 0.75rem 0 0;
  font-family: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(1rem, 0.2vw + 0.96rem, 1.1rem);
  font-style: normal;
  line-height: 1.58;
}

.note-page .content-header .meta-row {
  gap: 0.85rem;
  margin-top: 0;
}

.note-page .content-header .meta-pill,
.note-page .content-header .tag-chip {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.note-page .content-header .tag-chip:hover {
  color: var(--accent-strong);
}

.note-share-shell {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-control);
}

.share-note-button {
  min-height: 34px;
  padding: 0.42rem 0.78rem;
  border: var(--border-divider);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 650 0.76rem/1 var(--font-ui);
}

.share-note-button:hover,
.share-note-button[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.share-note-button:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 3px;
}

.share-note-popover {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  z-index: var(--z-overlay);
  width: min(21rem, calc(100vw - 2rem));
  padding: 0.9rem;
  border: var(--border-surface);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  font-family: var(--font-ui);
}

.share-note-popover[hidden] {
  display: none;
}

.share-note-label {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.share-note-title {
  display: block;
  margin-top: 0.28rem;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.35;
}

.share-note-url {
  display: block;
  margin-top: 0.6rem;
  padding: 0.52rem 0.6rem;
  overflow: hidden;
  border: var(--border-divider);
  border-radius: 8px;
  background: var(--field-bg);
  color: var(--muted);
  font-size: var(--type-size-label);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-note-popover-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 0.7rem;
}

.share-note-copy {
  padding: 0.46rem 0.72rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  cursor: pointer;
  font: 700 0.74rem/1 var(--font-ui);
}

.note-share-feedback {
  min-height: 1em;
  color: var(--muted);
  font-size: 0.72rem;
}

.note-page .content-panel > .note-body,
:root[data-view="focus"] .note-page .content-panel > .note-body {
  width: min(100%, var(--measure-reader-wide));
  margin-inline: auto;
}

.note-page .note-body > * {
  max-width: var(--measure-prose);
  margin-left: auto;
  margin-right: auto;
}

.note-page .note-body > table {
  max-width: 58rem;
  font-size: var(--type-size-default);
  line-height: 1.55;
}

.note-page .note-body > p:has(> img:only-child),
.note-page .note-body > figure,
.note-page .note-body > .interactive-diagram {
  max-width: 72rem;
}

:root {
  --reading-body-font: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --reading-heading-font: var(--reading-body-font);
}

:root[data-font="georgia"] {
  --reading-body-font: Georgia, "Times New Roman", serif;
  --reading-heading-font: var(--reading-body-font);
}

:root[data-font="palatino"] {
  --reading-body-font: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --reading-heading-font: var(--reading-body-font);
}

:root[data-font="sans"] {
  --reading-body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --reading-heading-font: var(--reading-body-font);
}

:root[data-font="claude"] {
  --reading-body-font: "Anthropic Sans", Avenir, "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --reading-heading-font: var(--reading-body-font);
}

:root[data-font="medium"] {
  --reading-body-font: source-serif-pro, Georgia, Cambria, "Times New Roman", Times, serif;
  --reading-heading-font: sohne, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

:root[data-font="avenir"] {
  --reading-body-font: Avenir, "Avenir Next", "Segoe UI", sans-serif;
  --reading-heading-font: var(--reading-body-font);
}

:root[data-font="mono"] {
  --reading-body-font: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --reading-heading-font: var(--reading-body-font);
}

.note-page .note-body,
.note-page .content-header .note-description {
  font-family: var(--reading-body-font);
}

.note-page .note-body {
  --measure-prose: 46rem;
  --note-media-edge-inset: max(0px, calc((100% - var(--measure-prose)) / 2));
  font-size: clamp(1rem, 0.18vw + 0.97rem, 1.08rem);
}

.note-page .content-header h1,
.note-page .note-body h1,
.note-page .note-body h2,
.note-page .note-body h3,
.note-page .note-body h4,
.note-page .note-body h5,
.note-page .note-body h6 {
  font-family: var(--reading-heading-font);
}

.note-page .note-body table,
.note-page .note-body .interactive-diagram {
  font-family: var(--font-ui);
}

.note-page .note-body h2 {
  font-size: clamp(1.5rem, 2vw, 1.86rem);
  line-height: 1.18;
}

.note-page .note-body h3 {
  font-size: 1.4rem;
  line-height: 1.3;
}

.note-page .note-body h4 {
  font-size: 1.27rem;
  line-height: 1.32;
}

.note-page .note-body h5 {
  font-size: 1.17rem;
  line-height: 1.34;
}

.note-page .note-body h6 {
  font-size: 1.1rem;
  line-height: 1.36;
}

.note-page .note-body img {
  /* Natural size, capped at the standard media width. Authored width attrs
     below preserve editor resizing in article view. */
  width: auto;
  max-width: min(100%, 600px);
  height: auto;
  border-radius: 4px;
  box-shadow: none;
}
.note-page .note-body img[width] {
  max-width: min(100%, 980px);
}
.note-page .note-body img[data-align="left"] {
  max-width: min(100%, var(--measure-prose), 980px);
  margin-left: 0;
  margin-right: auto;
}
.note-page .note-body img[data-align="right"] {
  max-width: min(100%, var(--measure-prose), 980px);
  margin-left: auto;
  margin-right: 0;
}
.note-page .note-body .note-image-captioned[data-align="left"] {
  margin-left: 0;
  margin-right: auto;
}
.note-page .note-body .note-image-captioned[data-align="right"] {
  margin-left: auto;
  margin-right: 0;
}

/* Alignment belongs to the prose column, not the wider centered-media lane.
   Keep nested images relative to their paragraph; only direct media needs the
   column inset. Centered images retain their existing wide-media behavior. */
.note-page .note-body > p:has(> img[data-align="left"]:only-child),
.note-page .note-body > p:has(> img[data-align="right"]:only-child) {
  max-width: var(--measure-prose);
}

.note-page .note-body blockquote {
  margin-top: 0.9em;
  margin-bottom: 0.9em;
  padding: 0.28rem 0.95rem;
  border-radius: 0;
  background: transparent;
  font-size: 0.96em;
  line-height: 1.58;
}

.note-page .note-body blockquote > :first-child {
  margin-top: 0;
}

.note-page .note-body blockquote > :last-child {
  margin-bottom: 0;
}

.note-page .note-body blockquote p {
  margin-top: 0.28rem;
  margin-bottom: 0.28rem;
}

.note-layout-visual .note-body > p:has(> img:only-child),
.note-layout-visual .note-body > figure,
.note-layout-visual .note-body > .interactive-diagram {
  width: min(100%, var(--measure-reader-wide));
}

.note-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-tight);
  color: var(--muted);
  font-size: 0.78rem;
}

.note-status::before {
  content: "";
  width: 0.46rem;
  height: 0.46rem;
  border-radius: var(--radius-circle);
  background: var(--faint);
}

.note-status-published::before { background: var(--accent); }
.note-status-draft::before { background: #d69b5a; }
.note-status-private::before { background: var(--faint); }

.note-footer-nav {
  width: min(100%, var(--measure-reader-wide));
  margin: 5rem auto 0;
  padding-top: 0.9rem;
  border-top: var(--border-divider);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-5);
}

.note-footer-adjacent {
  display: contents;
}

.note-footer-link {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  justify-content: center;
  padding: 0.3rem 0;
  color: var(--text);
  text-decoration: none;
  border-radius: 0.42rem;
  transition: color 150ms ease, background-color 150ms ease;
}

.note-footer-link:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.note-footer-link:focus-visible { outline: var(--focus-outline); outline-offset: 4px; }
.note-footer-link-previous { grid-column: 1; text-align: left; }
.note-footer-link-next { grid-column: 2; text-align: right; }
.note-footer-direction {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.note-footer-title {
  overflow: hidden;
  font-size: 0.86rem;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-footer-placeholder { display: none; }

:root[data-view="focus"] .note-page .content-panel {
  padding: clamp(0.65rem, 1.1vw, 1rem) clamp(1rem, 4vw, 4.6rem) 0.9rem;
}

:root[data-reading="left"] .note-page .content-panel > .content-header,
:root[data-reading="left"] .note-page .content-panel > .note-body {
  /* Wide reading still needs one shared edge for the article header and prose. */
  width: min(100%, var(--measure-reader-wide));
  margin-left: auto;
  margin-right: auto;
}

:root[data-reading="left"] .note-page .note-body > * {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

:root[data-reading="left"] .note-page .note-body {
  --measure-prose: 100%;
  --note-media-edge-inset: 0px;
}

.note-page .note-body > :is(img, figure, .note-image-captioned)[data-align="left"] {
  max-width: min(100%, var(--measure-prose), 980px);
  margin-left: var(--note-media-edge-inset);
  margin-right: auto;
}
.note-page .note-body > :is(img, figure, .note-image-captioned)[data-align="right"] {
  max-width: min(100%, var(--measure-prose), 980px);
  margin-left: auto;
  margin-right: var(--note-media-edge-inset);
}

/* Folder lanes: horizontal changes category; vertical explores that category. */
.folder-page .content-panel {
  padding: 0;
}

.folder-page .folder-summary {
  width: 100%;
  max-width: none;
  margin: 0;
  gap: 0;
}

.folder-page .folder-hero {
  max-width: none;
  padding: clamp(1.35rem, 2.5vw, 2.3rem) clamp(1.15rem, 4vw, 4.5rem) clamp(1.1rem, 2vw, 1.65rem);
}

/* The folder page is a workspace rather than a stretched reading article.
   Its rail gives every theme the same orientation/search/filter structure;
   colours deliberately come only from the existing theme token registry. */
.folder-workspace {
  position: sticky;
  top: 0;
  z-index: var(--z-flag);
  display: grid;
  gap: 0;
  border-bottom: var(--border-divider);
  background: color-mix(in srgb, var(--content-bg) 94%, var(--surface-2));
  backdrop-filter: blur(16px);
}

.folder-workspace-main,
.folder-workspace-tags {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-inline: clamp(1.15rem, 4vw, 4.5rem);
}

.folder-workspace-main {
  min-height: 3.7rem;
  justify-content: space-between;
  border-bottom: 1px solid color-mix(in srgb, var(--separator) 72%, transparent);
}

.folder-workspace-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.52rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 650;
  white-space: nowrap;
}

.folder-workspace-brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 780;
  letter-spacing: -0.015em;
}
.folder-workspace-brand:hover { color: var(--accent-strong); }
.folder-workspace-separator { color: var(--faint); }
.folder-workspace-location { overflow: hidden; text-overflow: ellipsis; }

.folder-workspace-search {
  width: min(100%, 27rem);
  min-height: 2.2rem;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 0.45rem 0 0.68rem;
  border: var(--border-divider);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
  color: var(--muted);
  transition: border-color 150ms ease, background-color 150ms ease;
}
.folder-workspace-search:focus-within {
  border-color: var(--accent);
  background: var(--surface-2);
}
.folder-workspace-search svg {
  width: 0.92rem;
  height: 0.92rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}
.folder-workspace-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}
.folder-workspace-search input::placeholder { color: var(--faint); }
.folder-workspace-search kbd {
  min-width: 1.25rem;
  padding: 0.08rem 0.28rem;
  border: var(--border-divider);
  border-radius: 4px;
  color: var(--faint);
  font-family: inherit;
  font-size: var(--type-size-label);
  line-height: 1.2;
  text-align: center;
}

.folder-workspace-tags {
  min-height: 2.95rem;
  gap: var(--space-tight);
  overflow-x: auto;
  scrollbar-width: none;
}
.folder-workspace-tags::-webkit-scrollbar { display: none; }
.folder-workspace-tags-label {
  flex: 0 0 auto;
  margin-right: 0.15rem;
  color: var(--faint);
  font-family: var(--font-ui);
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.folder-workspace-tag {
  flex: 0 0 auto;
  min-height: 1.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid transparent;
  border-radius: var(--radius-compact);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 620;
  white-space: nowrap;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}
.folder-workspace-tag span { color: var(--faint); font-size: 0.68rem; }
.folder-workspace-tag:hover,
.folder-workspace-tag.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--separator));
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.folder-workspace-tag:hover span,
.folder-workspace-tag.is-active span { color: currentColor; }
.folder-workspace-tag:focus-visible,
.folder-workspace-search:focus-within { outline: var(--focus-outline); outline-offset: 2px; }

:root[data-view="focus"] .folder-page .content-panel > .folder-summary {
  width: 100%;
  max-width: none;
  margin: 0;
}

.folder-board-nav {
  position: relative;
  z-index: var(--z-row);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
  margin: 0;
  padding: 0.7rem clamp(1.15rem, 4vw, 4.5rem);
  border-bottom: var(--border-divider);
  background: color-mix(in srgb, var(--content-bg) 90%, transparent);
  backdrop-filter: blur(14px);
}

.folder-board-nav-balanced .folder-board-step { display: none; }
.folder-board-nav-balanced { grid-template-columns: minmax(0, 1fr); }

.folder-board-step,
.folder-board-tab {
  min-height: 36px;
  border: var(--border-divider);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.folder-board-step {
  width: 36px;
  padding: 0;
  font-size: 1.15rem;
}

.folder-board-tabs {
  display: flex;
  gap: 0.35rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.folder-board-tabs::-webkit-scrollbar { display: none; }
.folder-board-tab { padding: 0.45rem 0.8rem; white-space: nowrap; }
.folder-board-tab:hover,
.folder-board-tab.is-active { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.folder-board-tab:focus-visible,
.folder-board-step:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }

.folder-page .folder-grid {
  grid-auto-columns: clamp(19rem, 28vw, 29rem);
  gap: 0;
  padding-right: clamp(1.15rem, 4vw, 4.5rem);
  padding-left: clamp(1.15rem, 4vw, 4.5rem);
  border-left: 0;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

/* Horizontal lanes communicate sibling categories. A leaf folder only has
   one category, so keep the board's vertical exploration but let that one
   lane fill the canvas instead of reserving an arbitrary 31vw strip. */
.folder-page .folder-grid-single {
  grid-template-columns: minmax(0, 1fr);
  grid-auto-columns: auto;
  padding-right: clamp(1rem, 2.15vw, 2.3rem);
  scroll-snap-type: none;
}

.folder-page .folder-grid-balanced {
  grid-template-columns: repeat(var(--folder-column-count), minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-columns: auto;
  padding-right: clamp(1.15rem, 4vw, 4.5rem);
  overflow-x: hidden;
  scroll-snap-type: none;
}

.folder-page .folder-column {
  position: relative;
  min-height: min(58vh, 44rem);
  max-height: calc(100vh - 18rem);
  padding: 0 1.35rem 1.3rem;
  overflow-y: auto;
  border-bottom: 0;
  background: color-mix(in srgb, var(--content-bg) 95%, var(--surface-3));
}

.folder-page .folder-column:nth-child(even) {
  background: color-mix(in srgb, var(--content-bg) 91%, var(--surface-3));
}

.folder-page .folder-column-header {
  position: sticky;
  top: 0;
  z-index: var(--z-row-top);
  min-height: 5rem;
  padding: 1rem 0 0.86rem;
  border-bottom: var(--border-divider);
  background: inherit;
}

.folder-page .folder-column-title strong { font-size: 1.05rem; }
.folder-page .folder-note-list { gap: 0; }
.folder-page .folder-open-grid > :last-child { border-bottom: none; }
.folder-page .folder-note-link,
.folder-page .folder-child-link {
  position: relative;
  min-height: 0;
  /* This is the rule that actually applies to board-column cards (body has
     class="folder-page" on both the board and open-list layouts) — the old
     0.1rem horizontal padding meant the hover fill hugged the text with
     almost no breathing room, which only became visible on hover since
     unhovered rows have no border to compare against. Negative margin
     cancels the padding's own indent so the text still lines up with the
     column header above it — only the hover fill extends past the text. */
  margin: 0 -0.65rem;
  padding: 0.94rem 0.7rem;
  border: 0;
  border-bottom: var(--border-divider);
  border-radius: 0;
  background: transparent;
  transition: background-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
}
.folder-page .folder-note-link:hover,
.folder-page .folder-child-link:hover {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.folder-page [data-folder-search][hidden] { display: none !important; }
.folder-page .folder-column.is-filter-empty .folder-note-list::after {
  content: "No matching notes in this category.";
  display: block;
  padding: 1rem 0.7rem;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.5;
}
@media (max-width: 860px) {
  .folder-workspace-main {
    min-height: auto;
    align-items: stretch;
    flex-direction: column;
    gap: 0.65rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .folder-workspace-search { width: 100%; }
  .folder-workspace-tags { min-height: 2.75rem; }
  .folder-page .folder-grid,
  .folder-page .folder-grid-balanced,
  .folder-page .folder-grid-single {
    padding-right: clamp(1rem, 4vw, 2rem);
    padding-left: clamp(1rem, 4vw, 2rem);
  }
}

/* ==== 07-editor-tools.css — Diagrams, slash/bubble menus, tooltips, block and image handles. ==== */

/* Interactive architecture diagrams. */
.interactive-diagram {
  margin-top: 2rem;
  margin-bottom: 2.3rem;
  border: var(--border-divider);
  background: color-mix(in srgb, var(--content-bg) 88%, #090806);
}

.interactive-diagram:focus-visible { outline: var(--focus-outline); outline-offset: 3px; }
.interactive-diagram-bar,
.interactive-diagram-actions,
.interactive-diagram-scenarios,
.interactive-diagram-transport,
.interactive-diagram-zoom {
  display: flex;
  align-items: center;
  gap: var(--space-tight);
}
.interactive-diagram-bar {
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0.72rem 0.82rem;
  border-bottom: var(--border-divider);
  flex-wrap: wrap;
}
.interactive-diagram-title {
  color: var(--muted);
  font-family: var(--font-mono-core);
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.diagram-button {
  min-height: 34px;
  padding: 0.38rem 0.65rem;
  border: var(--border-divider);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.diagram-button:hover,
.diagram-button.is-active { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.diagram-button:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
.diagram-stage-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem);
  min-height: 34rem;
}
.diagram-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background-image:
    linear-gradient(to right, rgba(242, 230, 211, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(242, 230, 211, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
}
.diagram-stage.is-dragging { cursor: grabbing; }
.diagram-canvas {
  width: 100%;
  height: 100%;
  min-height: 34rem;
  transform-origin: 50% 50%;
  transition: transform 220ms ease;
}
.diagram-canvas svg { display: block; width: 100%; height: 100%; min-height: 34rem; }
.diagram-panel {
  padding: 1.1rem;
  border-left: var(--border-divider);
  background: color-mix(in srgb, var(--surface-3) 55%, transparent);
}
.diagram-step-kicker {
  margin: 0 0 0.55rem;
  color: var(--accent-strong);
  font-family: var(--font-mono-core);
  font-size: var(--type-size-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.diagram-step-title { margin: 0; font-size: 1.08rem; }
.diagram-step-copy { margin: 0.65rem 0 0; color: var(--muted); line-height: 1.6; font-size: 0.9rem; }
.diagram-keyboard-hint { margin: 1.2rem 0 0; color: var(--faint); font-size: 0.72rem; line-height: 1.5; }
.diagram-progress { margin: 1rem 0 0; height: 2px; background: var(--separator); }
.diagram-progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 220ms ease; }
.interactive-diagram [data-node],
.interactive-diagram [data-edge] { transition: opacity 180ms ease, filter 180ms ease; }
.interactive-diagram [data-node] { cursor: pointer; }
.interactive-diagram .is-dimmed { opacity: 0.16; }
.interactive-diagram [data-node].is-active { opacity: 1; filter: drop-shadow(0 0 7px rgba(244, 189, 104, 0.48)); }
.interactive-diagram [data-edge].is-active { opacity: 1; filter: drop-shadow(0 0 3px rgba(244, 189, 104, 0.7)); }
.interactive-diagram:fullscreen { width: 100vw; height: 100vh; background: var(--content-bg); overflow: auto; }
.interactive-diagram:fullscreen .diagram-stage-shell { min-height: calc(100vh - 62px); }
.interactive-diagram:fullscreen .diagram-stage,
.interactive-diagram:fullscreen .diagram-canvas,
.interactive-diagram:fullscreen .diagram-canvas svg { min-height: calc(100vh - 62px); }
.diagram-linked-active { color: var(--accent-strong); }

/* Editor stays Markdown-first, with optional viewport previews. */
.editor-page .layout {
  height: calc(100vh - 1rem);
  margin: 1rem auto 0;
  border-radius: 16px 16px 0 0;
}

.editor-page .layout > .content-panel {
  padding: 1.15rem 1.15rem 0;
  overflow: hidden;
}
.editor-preview-tools { display: flex; gap: 0.35rem; margin-left: auto; }
.editor-page .editor-pane-header { display: flex; align-items: center; gap: var(--space-comfortable); }
.editor-preview-size {
  padding: 0.28rem 0.55rem;
  border: var(--border-divider);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--type-size-label);
  letter-spacing: 0;
  text-transform: none;
}
.editor-preview-size.is-active { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
.editor-preview-shell { display: grid; height: calc(68vh - 3.4rem); place-items: stretch; overflow: auto; background: color-mix(in srgb, var(--app-bg) 70%, var(--content-bg)); }
.editor-preview-shell[data-preview-size="mobile"] { place-items: start center; padding: 0.8rem; }
.editor-preview-shell[data-preview-size="mobile"] .editor-preview-frame { width: min(100%, 390px); }
.editor-publication-state { align-self: center; }

.editor-mode-tools { display: flex; align-items: center; gap: 0.35rem; }
.editor-mode-button {
  padding: 0.28rem 0.55rem;
  border: var(--border-divider);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--type-size-label);
  letter-spacing: 0;
  text-transform: none;
}
.editor-mode-button.is-active { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
.editor-mode-button:disabled { opacity: 0.5; cursor: not-allowed; }

.editor-view-link {
  color: var(--accent-strong);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.editor-view-link:hover,
.editor-view-link:focus-visible { text-decoration: underline; }
.editor-status-restore {
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 0.72rem;
}

.editor-view-switcher {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--space-comfortable);
}

.editor-focus-footer {
  position: fixed;
  z-index: var(--z-popover-top);
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 2.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0.42rem 0.8rem;
  border-top: var(--border-divider);
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
}


/* VS Code style: single editor pane by default, preview opens to the side on
   demand; rich text is a third, mutually-exclusive pane. These need to beat
   the `.editor-page .editor-pane { display: grid }` rule above on
   specificity, or the rich pane stays visible in every mode. */
.editor-page .editor-grid .editor-pane-rich { display: none; }
.editor-grid[data-view-mode="editor"] { grid-template-columns: minmax(0, 1fr); }
.editor-grid[data-view-mode="editor"] .editor-pane:not(:first-child) { display: none; }
.editor-grid[data-view-mode="rich"] { grid-template-columns: minmax(0, 1fr); }
.editor-grid[data-view-mode="rich"] .editor-pane { display: none; }
.editor-page .editor-grid[data-view-mode="rich"] .editor-pane-rich { display: grid; }
.editor-grid[data-view-mode="editor"] .editor-pane-header,
.editor-grid[data-view-mode="rich"] .editor-pane-header { display: none; }
.editor-grid[data-view-mode="editor"] .editor-textarea { min-height: 68vh; }

/* Editor-only and Rich text read like a normal article (centered column,
   same 70rem cap as .content-panel > .note-body); Split stays full width
   so the two panes have room to breathe side by side. */
.editor-grid[data-view-mode="editor"],
.editor-grid[data-view-mode="rich"] {
  width: min(100%, var(--measure-reader));
  margin-left: auto;
  margin-right: auto;
}

.editor-rich-mount {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}
.editor-rich-mount .ProseMirror {
  min-height: 100%;
  outline: none;
  /* Left gutter room for the block hover handles (Notion-style ＋ / ⋮⋮). */
  padding-left: 3.1rem;
  font-size: var(--type-size-default);
  line-height: 1.75;
}
/* Notion page-title treatment: the document's first heading reads as the
   page title — larger, no top margin. */
.editor-rich-mount .ProseMirror > h1:first-child {
  margin-top: 0.35rem;
  margin-bottom: 0.6em;
  font-size: 2.3rem;
  letter-spacing: -0.02em;
}
.editor-rich-mount .ProseMirror p.is-editor-empty:first-child::before {
  color: var(--muted);
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
}
.editor-raw-passthrough {
  padding: 0.6rem 0.8rem;
  border: 1px dashed var(--separator);
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
}

/* ---- Rich text content styling (T-A) -------------------------------
   Everything under .editor-rich-mount .ProseMirror mirrors .note-body
   conventions (same variables, same values) so Rich text reads as the
   same design system as the reading view and the preview pane. */
.editor-rich-mount .ProseMirror > * + * {
  margin-top: 0.78rem;
}
.editor-rich-mount .ProseMirror h1,
.editor-rich-mount .ProseMirror h2,
.editor-rich-mount .ProseMirror h3,
.editor-rich-mount .ProseMirror h4,
.editor-rich-mount .ProseMirror h5,
.editor-rich-mount .ProseMirror h6 {
  margin: 1.5em 0 0.45em;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.012em;
}
.editor-rich-mount .ProseMirror h1:first-child,
.editor-rich-mount .ProseMirror h2:first-child,
.editor-rich-mount .ProseMirror h3:first-child {
  margin-top: 0;
}
.editor-rich-mount .ProseMirror h1 { font-size: 1.6rem; }
.editor-rich-mount .ProseMirror h2 {
  font-size: 1.3rem;
}
.editor-rich-mount .ProseMirror h3 { font-size: 1.08rem; }
.editor-rich-mount .ProseMirror h4 { font-size: 0.97rem; }
.editor-rich-mount .ProseMirror h5,
.editor-rich-mount .ProseMirror h6 { font-size: 0.92rem; }
.editor-rich-mount .ProseMirror p {
  margin: 0.78rem 0;
}
.editor-rich-mount .ProseMirror ul,
.editor-rich-mount .ProseMirror ol {
  margin: 0.78rem 0;
  padding-left: 1.65rem;
}
.editor-rich-mount .ProseMirror li { line-height: 1.58; }
.editor-rich-mount .ProseMirror li + li {
  margin-top: 0.48rem;
}
.editor-rich-mount .ProseMirror li > p {
  margin: 0;
}
.editor-rich-mount .ProseMirror li > ul,
.editor-rich-mount .ProseMirror li > ol {
  margin: 0.5rem 0 0.58rem;
  padding-left: 1.65rem;
  color: color-mix(in srgb, var(--text) 84%, var(--muted));
}
.editor-rich-mount .ProseMirror li > ul > li,
.editor-rich-mount .ProseMirror li > ol > li { line-height: 1.52; }
.editor-rich-mount .ProseMirror blockquote {
  margin: 0.78rem 0;
  padding: 0.4rem 1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--quote-bg);
  color: var(--quote-text);
}
.editor-rich-mount .ProseMirror blockquote p {
  margin: 0;
}
.editor-rich-mount .ProseMirror a {
  color: var(--link);
  overflow-wrap: anywhere;
}
.editor-rich-mount .ProseMirror code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.editor-rich-mount .ProseMirror :not(pre) > code {
  padding: 0.12rem 0.34rem;
  border-radius: var(--radius-compact);
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.editor-rich-mount .ProseMirror pre {
  margin: 0.85rem 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-popover);
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-text);
  tab-size: 2;
  white-space: pre;
}
.editor-rich-mount .ProseMirror pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.86em;
}
/* Lowlight (hljs-*) token colors — same variables the reading view's
   pandoc sourceCode spans use, so a block looks identical in both. */
.editor-rich-mount .ProseMirror pre code.hljs { color: var(--code-variable); }
.editor-rich-mount .ProseMirror pre .hljs-comment,
.editor-rich-mount .ProseMirror pre .hljs-doctag { color: var(--code-comment); font-style: italic; }
.editor-rich-mount .ProseMirror pre .hljs-keyword,
.editor-rich-mount .ProseMirror pre .hljs-selector-tag,
.editor-rich-mount .ProseMirror pre .hljs-meta .hljs-keyword { color: var(--code-keyword); font-weight: 600; }
.editor-rich-mount .ProseMirror pre .hljs-attribute,
.editor-rich-mount .ProseMirror pre .hljs-meta { color: var(--code-annotation); }
.editor-rich-mount .ProseMirror pre .hljs-string,
.editor-rich-mount .ProseMirror pre .hljs-char.escape_,
.editor-rich-mount .ProseMirror pre .hljs-symbol { color: var(--code-string); }
.editor-rich-mount .ProseMirror pre .hljs-number,
.editor-rich-mount .ProseMirror pre .hljs-literal { color: var(--code-number); }
.editor-rich-mount .ProseMirror pre .hljs-title,
.editor-rich-mount .ProseMirror pre .hljs-title.function_ { color: var(--code-function); }
.editor-rich-mount .ProseMirror pre .hljs-title.class_,
.editor-rich-mount .ProseMirror pre .hljs-type,
.editor-rich-mount .ProseMirror pre .hljs-built_in { color: var(--code-type); }
.editor-rich-mount .ProseMirror pre .hljs-variable,
.editor-rich-mount .ProseMirror pre .hljs-template-variable { color: var(--code-variable); }
.editor-rich-mount .ProseMirror pre .hljs-operator,
.editor-rich-mount .ProseMirror pre .hljs-punctuation { color: var(--code-operator); }
.editor-rich-mount .ProseMirror pre .hljs-meta .hljs-string { color: var(--code-string); }
.editor-rich-mount .ProseMirror pre .hljs-section { color: var(--code-function); }
.editor-rich-mount .ProseMirror pre .hljs-name { color: var(--code-keyword); }
.editor-rich-mount .ProseMirror pre .hljs-emphasis { font-style: italic; }
.editor-rich-mount .ProseMirror pre .hljs-strong { font-weight: 700; }
.editor-rich-mount .ProseMirror table {
  width: 100%;
  margin: 0.78rem 0;
  border-collapse: collapse;
  background: var(--content-bg);
}
.editor-rich-mount .ProseMirror th,
.editor-rich-mount .ProseMirror td {
  padding: 0.7rem 0.8rem;
  border: var(--border-surface);
  text-align: left;
  vertical-align: top;
}
.editor-rich-mount .ProseMirror th {
  background: var(--table-header-bg);
  font-weight: 700;
}
.editor-rich-mount .ProseMirror .selectedCell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: var(--z-row);
  background: var(--accent-soft);
  pointer-events: none;
}
.editor-rich-mount .ProseMirror th,
.editor-rich-mount .ProseMirror td {
  position: relative;
}
/* Column-resize strip (Table resizable: true) */
.editor-rich-mount .ProseMirror .column-resize-handle {
  position: absolute;
  top: 0;
  right: -2px;
  bottom: -2px;
  width: 4px;
  background: var(--accent);
  pointer-events: none;
}
.editor-rich-mount .ProseMirror.resize-cursor {
  cursor: col-resize;
}
.editor-rich-mount .ProseMirror hr {
  border: 0;
  border-top: var(--border-surface);
  margin: 2rem 0;
}
/* Divider node view: the wrapper is the click target, so give it a tall,
   pointer-friendly band while the inner rule stays a thin line. */
.editor-rich-mount .ProseMirror .editor-hr {
  margin: 1.4rem 0;
  padding: 0.6rem 0;
  border-radius: var(--radius-compact);
}
.editor-rich-mount .ProseMirror .editor-hr hr {
  margin: 0;
}
.editor-rich-mount .ProseMirror .editor-hr.ProseMirror-selectednode {
  background: var(--accent-soft);
  outline: none;
}
.editor-rich-mount .ProseMirror .editor-hr.ProseMirror-selectednode hr {
  border-top-color: var(--accent);
}
.editor-rich-mount .ProseMirror img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.15rem auto;
  border-radius: var(--radius-popover);
  border: var(--border-divider);
  box-shadow: var(--shadow-sm);
}
.editor-rich-mount .ProseMirror img.ProseMirror-selectednode {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Task lists — TipTap TaskList markup: ul[data-type=taskList] > li >
   label + div. Native checkboxes render as OS-default and look wrong
   against the themed UI, so style the label-wrapped input directly. */
.editor-rich-mount .ProseMirror ul[data-type="taskList"] {
  padding-left: 0.25rem;
  list-style: none;
}
.editor-rich-mount .ProseMirror ul[data-type="taskList"] li {
  display: flex;
  gap: var(--space-control);
  align-items: flex-start;
}
.editor-rich-mount .ProseMirror ul[data-type="taskList"] li > label {
  flex-shrink: 0;
  margin-top: 0.32em;
}
.editor-rich-mount .ProseMirror ul[data-type="taskList"] li > div {
  flex: 1 1 auto;
  min-width: 0;
}
.editor-rich-mount .ProseMirror ul[data-type="taskList"] li > div > p {
  margin: 0;
}
.editor-rich-mount .ProseMirror ul[data-type="taskList"] input[type="checkbox"] {
  appearance: none;
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--panel-border);
  border-radius: 5px;
  background: var(--input-bg);
  cursor: pointer;
  display: block;
  position: relative;
}
.editor-rich-mount .ProseMirror ul[data-type="taskList"] input[type="checkbox"]:checked {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}
.editor-rich-mount .ProseMirror ul[data-type="taskList"] input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 0.28em;
  top: 0.12em;
  width: 0.22em;
  height: 0.48em;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.editor-rich-mount .ProseMirror ul[data-type="taskList"] li[data-checked="true"] > div {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}
/* CommentMark — global mark/mark[data-comment] rules above already apply;
   keep a cursor hint while editing. */
.editor-rich-mount .ProseMirror mark[data-comment] {
  cursor: pointer;
}

/* ---- Slash menu (T-B) ----------------------------------------------
   Reuses the folder-picker dropdown's visual language: same border,
   radius, surface, shadow, and hover treatment. */
.editor-slash-menu {
  position: fixed;
  z-index: var(--z-overlay);
  min-width: 15rem;
  max-width: 20rem;
  max-height: 18rem;
  overflow-y: auto;
  border: var(--border-surface);
  border-radius: var(--radius-popover);
  background: var(--panel);
  box-shadow: var(--elevation-context-menu);
}
.editor-slash-list {
  padding: 0.25rem;
}
.editor-slash-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-control);
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  text-align: left;
  cursor: pointer;
}
.editor-slash-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  flex-shrink: 0;
  border: var(--border-surface);
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--muted);
}
.editor-slash-icon svg {
  width: 1rem;
  height: 1rem;
  display: block;
}
.editor-slash-item:hover,
.editor-slash-item.is-highlighted,
.editor-slash-item.is-current {
  background: var(--accent-soft);
}
.editor-block-menu .editor-slash-item.is-current::after {
  margin-left: auto;
  color: var(--accent-strong);
  content: "✓";
  font-weight: 700;
}
.editor-slash-item:hover .editor-slash-icon,
.editor-slash-item.is-highlighted .editor-slash-icon {
  color: var(--accent-strong);
  border-color: var(--accent);
}
.editor-slash-item-title {
  font-size: 0.88rem;
  font-weight: 600;
}
.editor-slash-item-hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
}
.editor-slash-empty {
  padding: 0.55rem 0.7rem;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---- Bubble menu (T-C/T-D/T-F) -------------------------------------- */
.editor-link-popover {
  position: fixed;
  z-index: var(--z-popover-max);
  display: grid;
  gap: 0.8rem;
  width: min(360px, calc(100vw - 16px));
  box-sizing: border-box;
  padding: 1rem;
  border: var(--border-surface);
  border-radius: var(--radius-popover);
  /* Popovers cover editable content; use the opaque panel surface so text
     beneath the floating form cannot show through translucent dark-theme
     surface tokens. */
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-ui);
  box-shadow: var(--shadow-sm);
}
.editor-link-popover[hidden] { display: none; }
.editor-link-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  font-size: var(--type-size-meta);
  color: var(--muted);
}
.editor-link-field input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  border: var(--border-surface);
  border-radius: var(--radius-compact);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.editor-link-field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.editor-link-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
}
.editor-link-actions button {
  padding: 0.4rem 0.65rem;
  border: var(--border-surface);
  border-radius: var(--radius-compact);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--type-size-meta);
  cursor: pointer;
}
.editor-link-actions .editor-link-remove {
  margin-right: auto;
  color: var(--muted);
}
.editor-link-actions .editor-link-save {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.editor-link-actions button:hover { background: var(--accent-soft); }

.editor-bubble-menu {
  padding: 0.2rem;
}
.editor-bubble-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.28rem;
  border: var(--border-surface);
  border-radius: var(--radius-popover);
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}
.editor-bubble-row[hidden] {
  display: none;
}
.editor-bubble-table {
  position: relative;
}
.editor-table-toggle {
  min-width: 2.35rem;
}
.editor-table-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: var(--z-row-top);
  display: grid;
  min-width: 11.75rem;
  padding: 0.3rem;
  border: var(--border-surface);
  border-radius: var(--radius-control);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.editor-table-menu[hidden] { display: none; }
.editor-table-menu-item {
  min-height: 2rem;
  padding: 0.36rem 0.58rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.editor-table-menu-item:hover,
.editor-table-menu-item:focus-visible {
  outline: 0;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.editor-table-menu-item.is-danger:hover,
.editor-table-menu-item.is-danger:focus-visible {
  background: var(--danger-soft);
  color: var(--danger);
}
.editor-bubble-overflow {
  margin-top: 0.3rem;
}
.editor-bubble-button {
  min-width: 2.15rem;
  height: 2.15rem;
  padding: 0 0.55rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
}
.editor-bubble-button svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}
.editor-bubble-letter {
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}
.editor-bubble-button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.editor-bubble-button.is-active {
  background: var(--accent);
  color: var(--accent-strong);
}

/* ---- Tooltips (instant, styled — native title is slow/ugly) ---------- */
.editor-bubble-button[data-tip],
.editor-block-handle[data-tip],
.editor-code-lang-label[data-tip] {
  position: relative;
}
.editor-bubble-button[data-tip]::after,
.editor-block-handle[data-tip]::after,
.editor-code-lang-label[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  z-index: var(--z-popover-max);
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%) translateY(2px);
  padding: 0.22rem 0.55rem;
  border: var(--border-surface);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--type-size-label);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease 250ms, transform 120ms ease 250ms;
}
.editor-bubble-button[data-tip]:hover::after,
.editor-block-handle[data-tip]:hover::after,
.editor-code-lang-label[data-tip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* Gutter handles: tooltip opens to the RIGHT (above is screen edge-ish). */
.editor-block-handle.tip-right[data-tip]::after {
  left: calc(100% + 9px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%) translateX(2px);
}
.editor-block-handle.tip-right[data-tip]:hover::after {
  transform: translateY(-50%) translateX(0);
}

/* ---- Block hover handles (Notion pass) -------------------------------- */
.editor-block-handles {
  position: fixed;
  z-index: var(--z-tip);
  display: flex;
  align-items: center;
  gap: var(--space-compact);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}
.editor-block-handles.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.editor-block-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.editor-block-handle:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.editor-block-plus {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
}
.editor-block-grip {
  cursor: grab;
}
.editor-block-menu {
  min-width: 11rem;
}
.editor-slash-item:disabled {
  opacity: 0.45;
  cursor: default;
}
.editor-slash-item:disabled:hover {
  background: transparent;
  color: var(--text);
}

/* ---- Code language label + menu (Notion pass) ------------------------- */
.editor-code-lang-label {
  position: fixed;
  z-index: var(--z-header);
  display: inline-flex;
  align-items: center;
  height: 1.55rem;
  padding: 0 0.55rem;
  border: var(--border-surface);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.editor-code-lang-label.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.editor-code-lang-label:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
}
.editor-code-lang-menu {
  position: fixed;
  z-index: var(--z-overlay);
  width: 15rem;
  display: none;
  flex-direction: column;
  border: var(--border-surface);
  border-radius: var(--radius-popover);
  background: var(--panel);
  box-shadow: var(--elevation-context-menu);
}
.editor-code-lang-menu.is-open {
  display: flex;
}
.editor-code-lang-search {
  margin: 0.45rem;
  padding: 0.4rem 0.6rem;
  border: var(--border-surface);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  outline: none;
}
.editor-code-lang-search:focus {
  border-color: var(--accent);
}
.editor-code-lang-list {
  max-height: 14rem;
  overflow-y: auto;
  padding: 0 0.25rem 0.25rem;
}
.editor-code-lang-option.is-current {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ---- Image resize handles (T-G) -------------------------------------- */
.editor-rich-mount .ProseMirror .editor-resizable-image {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 1.15rem auto;
}
.editor-rich-mount .ProseMirror .editor-image-frame {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  line-height: 0;
}
.editor-rich-mount .ProseMirror .editor-resizable-image img {
  display: block;
  margin: 0;
}
.editor-image-align-controls {
  position: absolute;
  z-index: var(--z-popover-top);
  top: -2.05rem;
  left: 50%;
  display: flex;
  gap: 0.15rem;
  padding: 0.15rem;
  border: var(--border-surface);
  border-radius: 0.4rem;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
}
.editor-resizable-image.is-selected .editor-image-align-controls,
.editor-resizable-image:hover .editor-image-align-controls,
.editor-resizable-image:focus-within .editor-image-align-controls {
  opacity: 1;
  pointer-events: auto;
}
.editor-image-align-controls button {
  width: 1.45rem;
  height: 1.35rem;
  padding: 0;
  border: 0;
  border-radius: 0.25rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}
.editor-image-align-controls button:hover,
.editor-image-align-controls button.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.editor-rich-mount .ProseMirror .editor-resizable-image.is-selected img {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.editor-image-resize-handle {
  position: absolute;
  z-index: var(--z-popover-top);
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid var(--accent-strong);
  border-radius: var(--radius-circle);
  background: var(--surface-2);
  opacity: 0;
  transition: opacity 120ms ease;
}
.editor-image-resize-nw {
  left: -0.3rem;
  top: -0.3rem;
  cursor: nwse-resize;
}
.editor-image-resize-ne {
  right: -0.3rem;
  top: -0.3rem;
  cursor: nesw-resize;
}
.editor-image-resize-sw {
  left: -0.3rem;
  bottom: -0.3rem;
  cursor: nesw-resize;
}
.editor-image-resize-se {
  right: -0.3rem;
  bottom: -0.3rem;
  cursor: nwse-resize;
}
.editor-resizable-image:hover .editor-image-resize-handle,
.editor-resizable-image.is-selected .editor-image-resize-handle,
body.is-resizing-image .editor-image-resize-handle {
  opacity: 1;
}
.editor-image-caption-input {
  display: none;
  width: 100%;
  max-width: 100%;
  min-height: 1.8em;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-sizing: border-box;
  margin-top: 0.5rem;
  padding: 0.18rem 0.35rem;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--type-size-meta);
  font-style: italic;
  line-height: 1.45;
  text-align: center;
  outline: none;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}
.editor-resizable-image.is-selected .editor-image-caption-input,
.editor-resizable-image.has-caption .editor-image-caption-input,
.editor-resizable-image:focus-within .editor-image-caption-input {
  display: block;
}
.editor-image-caption-input::placeholder {
  color: var(--muted);
  opacity: 0.78;
}
.editor-image-caption-input:focus {
  border-bottom-color: var(--accent);
  color: var(--text);
}
body.is-resizing-image {
  user-select: none;
}

/* Compact single-row header keeps the markdown/preview panes as the hero. */
.editor-page .editor-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.editor-page .editor-topbar {
  align-items: center;
  /* Reserve the fixed settings control's footprint so Save cannot slide under it. */
  padding-right: 3.25rem;
}
.editor-page .editor-topbar h1 {
  margin: 0;
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  line-height: 1.2;
}
.editor-full-title-input {
  display: none;
}
.editor-identity { display: flex; align-items: baseline; gap: var(--space-comfortable); min-width: 0; }
.editor-back-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  cursor: pointer;
}
.editor-back-button:hover { color: var(--accent-strong); }
.editor-path-toggle {
  padding: 0.24rem 0.6rem;
  border: var(--border-divider);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.76rem;
  max-width: min(38vw, 26rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-path-toggle:hover,
.editor-path-toggle:focus-visible { border-color: var(--accent); color: var(--accent-strong); }
.editor-path-toggle[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.editor-page .editor-status {
  max-width: min(30vw, 20rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The editor takes the remaining height so the status footer stays at the
   bottom of the content panel instead of floating above its bottom edge. */
.editor-page .editor-grid {
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
}
.editor-page .editor-pane { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.editor-page .editor-textarea { height: 100%; min-height: 0; resize: none; }
.editor-page .editor-preview-shell { height: 100%; }
.editor-page .editor-preview-frame { height: 100%; min-height: 0; }
.editor-preview-frame { transition: opacity 100ms ease; }
.editor-preview-frame.is-refreshing { opacity: 0.6; }

/* Distraction-free rich-text mode. The footer is the only persistent chrome:
   it keeps writing statistics and the two actions needed to save or leave. */

/* Table right-click context menu */
.table-context-menu {
  position: fixed;
  z-index: 9999;
  background: var(--panel);
  border: 1px solid var(--border-color, #333);
  border-radius: var(--radius-compact);
  padding: 4px 0;
  min-width: 160px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.table-context-menu-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--text-primary, #e0e0e0);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}
.table-context-menu-item:hover {
  background: var(--bg-hover, #2a2a2a);
}
.table-context-menu-item.danger {
  color: #f87171;
}
.table-context-menu-item.danger:hover {
  background: rgba(248, 113, 113, 0.15);
}
.table-context-menu-separator {
  height: 1px;
  background: var(--border-color, #333);
  margin: 4px 0;
}

/* ==== 08-full-mode-responsive.css — Editor full mode, lightbox/toasts, responsive + reduced-motion blocks. ==== */

body.editor-full-mode {
  --editor-full-prose-width: 46rem;
  --editor-full-handle-gutter: 3.1rem;
  overflow: hidden;
}

/* Full editor deliberately escapes the standard app frame. The normal editor
   is inset to leave room for navigation, but distraction-free writing is a
   true viewport surface: no inherited margin, panel padding, or rounded app
   shell can leave a dark gutter above or beside its document header. */
html:has(body.editor-full-mode),
body.editor-full-mode {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body.editor-full-mode .floating-controls,
body.editor-full-mode .back-to-top,
body.editor-full-mode .edge-hover-zone,
body.editor-full-mode .sidebar-resizer,
body.editor-full-mode .sidebar-collapse-toggle,
body.editor-full-mode .sidebar,
body.editor-full-mode .toc-panel,
body.editor-full-mode .editor-meta,
body.editor-full-mode .editor-disabled,
body.editor-full-mode .editor-view-switcher,
body.editor-full-mode .editor-pane-header {
  display: none !important;
}

body.editor-full-mode .layout,
body.editor-full-mode .layout.has-toc {
  position: fixed;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
  margin: 0 !important;
  grid-template-columns: minmax(0, 1fr) !important;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.editor-full-mode .content-panel {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  padding: 0 !important;
  overflow: hidden;
}

body.editor-full-mode .editor-shell {
  height: 100svh;
  display: block;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding-bottom: 2.5rem;
  gap: 0;
}

body.editor-full-mode .editor-topbar {
  position: relative;
  width: 100%;
  max-width: none;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  padding: 0 clamp(1rem, 2vw, 2rem);
  border: 0;
  border-bottom: var(--border-divider);
  background: var(--surface-2);
}

.editor-full-header-actions {
  display: none;
}

body.editor-full-mode .editor-full-header-actions {
  position: absolute;
  right: clamp(0.75rem, 2vw, 2rem);
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.editor-full-header-mode,
.editor-full-header-article {
  min-height: 2rem;
  padding: 0.32rem 0.56rem;
  border: 1px solid transparent;
  border-radius: 0.42rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 650 0.76rem/1.2 var(--font-ui);
  white-space: nowrap;
}

.editor-full-header-mode:hover,
.editor-full-header-mode:focus-visible,
.editor-full-header-mode.is-active,
.editor-full-header-article:hover,
.editor-full-header-article:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: 0;
}

.editor-full-header-more {
  width: 2rem;
  min-height: 2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0.42rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 700 1.15rem/1 var(--font-ui);
}

.editor-full-header-more:hover,
.editor-full-header-more:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: 0;
}

body.editor-full-mode .editor-identity {
  width: 100%;
  box-sizing: border-box;
  min-height: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
  margin: 0;
}

body.editor-full-mode .editor-back-button,
body.editor-full-mode .editor-path-toggle,
body.editor-full-mode .editor-toolbar {
  display: none;
}

body.editor-full-mode .editor-topbar h1 {
  display: none;
}

.editor-full-breadcrumb {
  display: none;
}

body.editor-full-mode .editor-full-title-input {
  display: block;
  width: min(calc(100% - 25rem), 42rem);
  margin: 0;
  margin-right: auto;
  align-self: flex-start;
  padding: 0.1rem 0;
  border: 1px solid transparent;
  border-radius: 5px;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  font-weight: 720;
  letter-spacing: -0.014em;
  line-height: 1.2;
  text-align: left;
}

body.editor-full-mode .editor-full-title-input:hover {
  border-color: var(--separator);
}

body.editor-full-mode .editor-full-title-input:focus {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--surface-3) 70%, transparent);
  padding-inline: 0.42rem;
}

body.editor-full-mode .editor-grid,
body.editor-full-mode .editor-grid[data-view-mode="rich"] {
  width: 100%;
  height: auto !important;
  min-height: 0;
  margin: 0;
  gap: 0;
}

body.editor-full-mode .editor-grid[data-view-mode="rich"] .editor-pane-rich {
  height: auto;
  min-height: calc(100svh - 6.3rem);
  display: block;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body.editor-full-mode .editor-rich-mount {
  width: 100%;
  height: auto;
  min-height: calc(100svh - 6.3rem);
  overflow: visible;
  padding: clamp(1.35rem, 4vw, 3.5rem) max(1.1rem, calc((100vw - (var(--editor-full-prose-width) + var(--editor-full-handle-gutter))) / 2));
}

body.editor-full-mode .editor-rich-mount .ProseMirror {
  box-sizing: border-box;
  width: 100%;
  max-width: calc(var(--editor-full-prose-width) + var(--editor-full-handle-gutter));
  padding-left: var(--editor-full-handle-gutter);
  margin: 0 auto;
}

.editor-full-toc {
  display: none;
}

body.editor-full-mode .editor-full-toc {
  position: fixed;
  z-index: var(--z-popover);
  top: 4.5rem;
  /* Hug the outline instead of spanning top-to-bottom: a short TOC shouldn't
     paint a full-height card down an otherwise empty margin. Cap at the space
     between the header and footer so a long outline still scrolls internally. */
  bottom: auto;
  max-height: calc(100dvh - 4.5rem - 3.2rem);
  right: max(1rem, env(safe-area-inset-right));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(14rem, 18vw);
  gap: 0.48rem;
  padding: 0.72rem;
  border: var(--border-surface);
  border-radius: 0.68rem;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

body.editor-full-mode .editor-full-toc[hidden] {
  display: none;
}

.editor-full-toc-label {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.67rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-full-toc-list {
  /* display:block, not grid: a grid nested in the panel's minmax(0,1fr)
     track compresses its auto rows instead of scrolling (verified in
     headless Chrome). Block children scroll normally. */
  display: block;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  padding-right: 0.2rem;
}

.editor-full-toc-item {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0.34rem 0.42rem;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 600 0.76rem/1.35 var(--font-ui);
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-full-toc-level-3 { padding-left: 0.8rem; font-size: 0.73rem; }
.editor-full-toc-level-4 { padding-left: 1.18rem; font-size: 0.71rem; }
.editor-full-toc-item:hover,
.editor-full-toc-item:focus-visible,
.editor-full-toc-item.is-active {
  border-left-color: var(--accent);
  color: var(--accent-strong);
  outline: 0;
}

.editor-focus-stats,
.editor-focus-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.editor-focus-actions {
  display: none;
}

body.editor-full-mode .editor-focus-actions {
  display: flex;
}

body:not(.editor-full-mode) .editor-focus-footer {
  opacity: 0;
  transform: translateY(calc(100% - 8px));
  transition: opacity 140ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

body:not(.editor-full-mode) .editor-focus-footer:hover,
body:not(.editor-full-mode) .editor-focus-footer:focus-within {
  opacity: 1;
  transform: translateY(0);
}

.editor-focus-status {
  max-width: min(34vw, 18rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-focus-status[data-state="error"] {
  color: var(--danger);
}

.editor-focus-action {
  padding: 0.16rem 0.35rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}

.editor-focus-action:hover,
.editor-focus-action:focus-visible {
  color: var(--accent-strong);
}

@media (max-width: 980px) {
  body.editor-full-mode .editor-full-toc { display: none; }
}

@media (max-width: 600px) {
  body.editor-full-mode .editor-topbar {
    min-height: 6.75rem;
    align-items: flex-end;
    padding-bottom: 0.72rem;
  }

  body.editor-full-mode .editor-full-header-actions {
    top: 0.42rem;
    right: 0.65rem;
    gap: 0.12rem;
  }

  .editor-full-header-mode,
  .editor-full-header-article {
    padding-inline: 0.3rem;
    font-size: 0.65rem;
  }

  body.editor-full-mode .editor-full-title-input {
    width: 100%;
  }

  .editor-focus-footer {
    gap: var(--space-2);
    padding-inline: 0.55rem;
  }

  .editor-focus-stats,
  .editor-focus-actions {
    gap: var(--space-compact);
  }

  .editor-focus-status {
    display: none;
  }

  .tree-trash-undo {
    right: 0.6rem;
    bottom: 0.6rem;
  }
}

@media (max-width: 860px) {
  .back-to-top,
  body:has(.toc-panel:not(.toc-panel-empty)) .back-to-top,
  :root[data-view="focus"] .back-to-top {
    right: 1rem;
    bottom: 1rem;
  }

  .layout,
  .layout.has-toc,
  .layout.cards-layout,
  .layout.folder-open-layout,
  :root[data-view="focus"] .layout,
  :root[data-view="focus"] .layout.has-toc {
    width: 100%;
    height: auto;
    margin: 0;
    border-radius: 0;
  }

  .sidebar,
  :root[data-view="focus"] .sidebar {
    position: sticky;
    top: 0;
    z-index: var(--z-hover);
    width: 100%;
    max-height: none;
    padding: 0.55rem 0.75rem;
    overflow: visible;
    border-bottom: var(--border-divider);
    background: color-mix(in srgb, var(--sidebar-bg) 94%, transparent);
    backdrop-filter: blur(14px);
  }

  .sidebar-top {
    min-height: 2.35rem;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0 3.1rem 0 0;
  }

  .sidebar-brand .brand-heading {
    font-size: 1.08rem;
    letter-spacing: -0.01em;
  }

  .sidebar-brand p:not(.brand-heading) {
    display: none;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0.38rem 0.68rem;
    border: var(--border-divider);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 650;
  }

  .mobile-nav-toggle:hover,
  .mobile-nav-toggle[aria-expanded="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
  }

  .sidebar > .search-shell,
  .sidebar > .nav-pills,
  .sidebar > .sidebar-actions,
  .sidebar > .tree-header,
  .sidebar > .tree-wrap {
    display: none;
  }

  .sidebar.mobile-nav-open {
    max-height: min(78dvh, 42rem);
    overflow: auto;
  }

  .sidebar.mobile-nav-open > .search-shell,
  .sidebar.mobile-nav-open > .tree-wrap {
    display: block;
  }

  .sidebar.mobile-nav-open > .nav-pills,
  .sidebar.mobile-nav-open > .sidebar-actions,
  .sidebar.mobile-nav-open > .tree-header {
    display: flex;
  }

  .toc-panel,
  :root[data-view="focus"] .toc-panel {
    display: none !important;
  }

  .content-panel {
    min-height: calc(100dvh - 3.45rem);
  }

  .note-page .note-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .folder-page { overflow-x: hidden; }
  .folder-page .content-panel { padding-right: clamp(1rem, 4vw, 2rem); overflow-x: hidden; }
  .folder-page .folder-summary,
  .folder-page .folder-board-nav { min-width: 0; }
  .folder-page .folder-summary { width: 100%; max-width: calc(100vw - 2rem); }
  .folder-page .folder-board-nav { margin-right: 0; }
  .folder-page .folder-grid { width: 100%; max-width: 100%; grid-auto-columns: 100%; padding-right: 0; overflow-x: hidden; }
  .folder-page .folder-column { display: none; width: 100%; max-width: 100%; min-height: 32rem; max-height: none; overflow-x: hidden; border-left: var(--border-divider); }
  .folder-page .folder-note-list,
  .folder-page .folder-note-link,
  .folder-page .folder-child-link { width: 100%; max-width: 100%; }
  .folder-page .folder-column.is-active { display: grid; }
  .diagram-stage-shell { grid-template-columns: 1fr; }
  .diagram-panel { border-left: 0; border-top: var(--border-divider); }
  .diagram-stage,
  .diagram-canvas,
  .diagram-canvas svg { min-height: 27rem; }
}

@media (min-width: 861px) and (max-width: 1600px) {
  .diagram-stage-shell { grid-template-columns: 1fr; }
  .diagram-panel { border-left: 0; border-top: var(--border-divider); }
  .diagram-stage,
  .diagram-canvas,
  .diagram-canvas svg { min-height: 31rem; }
}

@media (max-width: 640px) {
  .note-page .content-panel { padding: 0.72rem 1rem 3rem; }
  .note-page .content-panel > .content-header,
  :root[data-view="focus"] .note-page .content-panel > .content-header {
    margin-bottom: 1.25rem;
    padding: 0 0 1.05rem;
  }
  .note-page .content-header h1 { margin-top: 0.62rem; font-size: clamp(1.9rem, 9vw, 2.4rem); }
  .note-page .content-header .note-description { margin-top: 0.55rem; line-height: 1.5; }
  .note-page .content-header .meta-row { gap: 0.42rem 0.7rem; }
  .note-meta-line { align-items: center; gap: var(--space-3); margin-top: 0.75rem; }
  .note-footer-nav { display: flex; align-items: stretch; flex-direction: column; gap: 0.7rem; margin-top: 2.4rem; padding-top: 0.8rem; }
  .note-footer-adjacent { width: 100%; display: flex; justify-content: stretch; }
  .note-footer-link { min-width: 0; flex: 1 1 50%; padding: 0.58rem 0.65rem; }
  .note-footer-link-previous { text-align: left; }
  .share-note-popover { width: min(20rem, calc(100vw - 2rem)); }
  .interactive-diagram-bar { align-items: flex-start; }
  .interactive-diagram-actions { width: 100%; flex-wrap: wrap; }
  .diagram-stage,
  .diagram-canvas,
  .diagram-canvas svg { min-height: 23rem; }
  .editor-preview-tools { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* Folder board workspace. The information architecture stays fixed across
   themes; theme variables alone provide the visual treatment. */
.folder-page .content-panel {
  padding: 0;
  overflow-x: hidden;
}

.folder-page .folder-summary,
:root[data-view="focus"] .folder-page .content-panel > .folder-summary {
  width: 100%;
  max-width: none;
  min-height: 100%;
  margin: 0;
}

.folder-page .folder-workspace {
  position: sticky;
  top: 0;
  z-index: var(--z-menu);
  align-self: start;
  display: grid;
  gap: 0;
  border: 0;
  border-bottom: var(--border-divider);
  background: color-mix(in srgb, var(--content-bg) 94%, var(--surface-2));
  backdrop-filter: blur(14px);
}

.folder-page .folder-appbar {
  display: flex;
  align-items: center;
  min-height: 3.6rem;
  gap: 0.65rem;
  padding: 0 clamp(1.15rem, 2.35vw, 3rem);
  border-bottom: var(--border-divider);
}

.folder-page .folder-app-brand,
.folder-page .folder-app-location,
.folder-page .folder-app-controls,
.folder-page .folder-contextbar,
.folder-page .folder-context-meta,
.folder-page .folder-breadcrumbs,
.folder-page .folder-board-lane-heading,
.folder-page .folder-board-card-footer {
  display: flex;
  align-items: center;
}

.folder-page .folder-app-brand {
  flex: 0 0 auto;
  gap: var(--space-2);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.94rem;
  font-weight: 760;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.folder-page .folder-app-brand:hover { color: var(--accent-strong); }

.folder-page .folder-app-mark {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 0.42rem;
  object-fit: cover;
}

.folder-page .folder-app-location {
  min-width: 0;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.83rem;
  font-weight: 620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-page .folder-app-controls {
  min-width: 0;
  margin-left: auto;
  padding-right: 2.8rem;
  gap: var(--space-compact);
}

.folder-page .folder-mobile-browse {
  display: none;
}

.folder-page .folder-workspace-search {
  width: min(19rem, 26vw);
  min-height: 2.35rem;
  display: flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0 0.48rem 0 0.68rem;
  border: var(--border-surface);
  border-radius: 0.45rem;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  color: var(--muted);
  transition: border-color 140ms ease, background-color 140ms ease;
}

.folder-page .folder-workspace-search,
.folder-page .folder-workspace-search input,
.note-page .toc-panel,
.note-page .toc-panel a {
  pointer-events: auto;
}

.folder-page .folder-workspace-search:focus-within {
  border-color: var(--accent);
  background: var(--surface-2);
}

.folder-page .folder-workspace-search svg {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
}

.folder-page .folder-workspace-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

.folder-page .folder-workspace-search input::placeholder { color: var(--faint); }

.folder-page .folder-workspace-search kbd {
  min-width: 1.25rem;
  padding: 0.07rem 0.26rem;
  border: var(--border-divider);
  border-radius: 0.24rem;
  color: var(--faint);
  font-family: inherit;
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: center;
}

.folder-page .folder-app-nav {
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  padding: 0 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--type-size-meta);
  font-weight: 670;
  text-decoration: none;
  white-space: nowrap;
}

.folder-page .folder-app-nav:hover { color: var(--text); background: var(--hover); }
.folder-page .folder-app-nav.is-active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--panel-border));
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.folder-page .folder-contextbar {
  min-height: 3.2rem;
  display: grid;
  grid-template-columns: minmax(12rem, 24rem) minmax(0, 1fr);
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 clamp(1.15rem, 2.35vw, 3rem);
  background: color-mix(in srgb, var(--content-bg) 88%, var(--accent-soft));
}

.folder-page .folder-breadcrumbs {
  min-width: 0;
  gap: var(--space-control);
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  white-space: nowrap;
}

.folder-page .folder-context-copy {
  min-width: 0;
}

.folder-page .folder-breadcrumbs a {
  overflow: hidden;
  color: var(--muted);
  text-decoration: none;
  text-overflow: ellipsis;
}

.folder-page .folder-breadcrumbs a:hover { color: var(--accent-strong); }
.folder-page .folder-breadcrumbs strong { color: var(--text); font-size: var(--type-size-default); }
.folder-page .folder-breadcrumb-separator { color: var(--faint); }

.folder-page .folder-context-meta { flex: 0 0 auto; gap: var(--space-compact); }
.folder-page .folder-workspace-board-nav {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
}

.folder-page .folder-board-nav-label {
  color: var(--faint);
  font-family: var(--font-ui);
  font-size: 0.67rem;
  font-weight: 760;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.folder-page .folder-workspace-board-nav .folder-board-tab {
  min-height: 2rem;
  border-color: var(--panel-border);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 650;
}

.folder-page .folder-workspace-board-nav .folder-board-tabs {
  justify-content: flex-start;
}

.folder-page .folder-workspace-board-nav .folder-board-tab {
  position: relative;
  padding: 0.35rem 0.7rem;
}

.folder-page .folder-workspace-board-nav .folder-board-tab.is-active {
  padding-right: 1.1rem;
}

.folder-page .folder-workspace-board-nav .folder-board-tab.is-active::after {
  content: "";
  position: absolute;
  top: 0.38rem;
  right: 0.38rem;
  width: 0.29rem;
  height: 0.29rem;
  border-radius: var(--radius-pill);
  background: var(--accent-strong);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-soft) 72%, transparent);
}
.folder-page .folder-context-count {
  padding: 0.34rem 0.62rem;
  border: var(--border-surface);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface-2) 75%, transparent);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
}

.folder-page .folder-board-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: calc(100dvh - 6.8rem);
  overflow: hidden;
  padding: clamp(1rem, 1.6vw, 1.45rem) clamp(0.9rem, 1.5vw, 1.5rem) clamp(1.25rem, 2.25vw, 2.25rem);
  background: var(--content-bg);
}

.folder-page .folder-board-grid {
  --folder-board-lane-width: 22.5rem;
  display: grid;
  grid-template-columns: repeat(var(--folder-board-column-count, var(--folder-board-lane-count)), var(--folder-board-lane-width));
  align-items: start;
  gap: var(--space-3);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 12rem;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.folder-page .folder-board-lane {
  min-width: 0;
  min-height: 12rem;
  max-height: calc(100dvh - 10.4rem);
  border: var(--border-surface);
  border-radius: 0.72rem;
  background: var(--surface-3);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 5%, transparent);
  scroll-snap-align: start;
}

.folder-page .folder-board-lane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.folder-page .folder-board-lane-header {
  min-height: 3.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-comfortable);
  padding: 0.65rem 0.75rem;
  border-bottom: var(--border-divider);
  background: color-mix(in srgb, var(--surface-2) 86%, var(--accent-soft));
}

.folder-page .folder-board-lane-heading { min-width: 0; gap: var(--space-control); }
.folder-page .folder-board-lane-title {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 760;
  letter-spacing: -0.016em;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-page .folder-board-lane-title:hover { color: var(--accent-strong); }
.folder-page .folder-board-count {
  display: inline-grid;
  min-width: 1.45rem;
  height: 1.45rem;
  place-items: center;
  padding: 0 0.28rem;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 760;
}

.folder-page .folder-board-lane-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--space-tight);
}

.folder-page .folder-board-add-note {
  flex: 0 0 auto;
  min-height: 1.65rem;
  display: inline-flex;
  align-items: center;
  padding: 0 0.48rem;
  border: var(--border-surface);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 720;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.folder-page .folder-board-add-note[hidden],
.folder-page .folder-board-add-lane[hidden],
.folder-page .folder-add-lane[hidden] {
  display: none !important;
}

.folder-page .folder-board-add-note:hover,
.folder-page .folder-board-add-note:focus-visible {
  border-color: color-mix(in srgb, var(--panel-border) 65%, var(--text));
  background: var(--surface-2);
  color: var(--text);
  outline: 0;
}

/* A board-level local action: intentionally a separate grid lane rather
   than a control inside the final folder column. */
.folder-page .folder-board-add-lane {
  min-height: 12rem;
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 1rem;
  border: 1px dashed var(--panel-border);
  border-radius: 0.72rem;
  background: color-mix(in srgb, var(--surface-3) 72%, transparent);
  scroll-snap-align: start;
}

.folder-page .folder-add-lane {
  min-height: 2.15rem;
  display: inline-flex;
  align-items: center;
  gap: var(--space-tight);
  padding: 0 0.65rem;
  border: 1px dashed var(--panel-border);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface-3) 90%, transparent);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 680;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.folder-page .folder-add-lane > span:first-child {
  font-size: var(--type-size-default);
  font-weight: 400;
}

.folder-page .folder-add-lane:hover,
.folder-page .folder-add-lane:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--surface-2) 88%, var(--accent-soft));
  color: var(--accent-strong);
  outline: 0;
}

.folder-page .folder-board-open {
  min-height: 1.65rem;
  display: inline-flex;
  align-items: center;
  padding: 0 0.48rem;
  border: var(--border-surface);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 680;
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.folder-page .folder-board-open:hover,
.folder-page .folder-board-open:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: 0;
}

.folder-page .folder-board-cards {
  display: grid;
  align-content: start;
  flex: 0 1 auto;
  min-height: 0;
  gap: var(--space-comfortable);
  padding: 0.65rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.folder-page .folder-board-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-compact);
  min-height: 7.9rem;
  padding: 0.8rem;
  border: var(--border-surface);
  border-radius: 0.58rem;
  background: var(--content-bg);
  color: var(--text);
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.folder-page .folder-board-card > .note-lock-badge {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.folder-page .folder-board-card:hover,
.folder-page .folder-board-card:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--surface-2) 78%, var(--accent-soft));
  box-shadow: none;
  outline: 0;
  transform: translateY(-1px);
}

.folder-page .folder-board-card-title {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.97rem;
  font-weight: 780;
  letter-spacing: -0.014em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-page .folder-board-card-summary {
  display: -webkit-box;
  overflow: hidden;
  color: color-mix(in srgb, var(--muted) 88%, var(--faint));
  font-family: var(--font-ui);
  font-size: 0.77rem;
  font-weight: 480;
  line-height: 1.48;
  min-height: calc(0.77rem * 1.48 * 2);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.folder-page .folder-board-card-footer {
  width: 100%;
  justify-content: flex-start;
  gap: var(--space-2);
  margin-top: auto;
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.66rem;
  line-height: 1.35;
}

.folder-page .folder-board-card-footer > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-page .folder-board-card-actions,
.folder-page .folder-board-card-flags {
  display: flex;
  align-items: center;
}
.folder-page .folder-board-card-actions {
  flex: 0 0 auto;
  gap: var(--space-compact);
  margin-left: 0;
}

.folder-page .folder-board-card-flags { margin-left: 0; }
.folder-page .folder-board-card-open {
  flex: 0 0 auto;
  margin-left: 0;
  color: var(--accent-strong);
  font-family: var(--font-ui);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 0.8;
  opacity: 0;
  transform: translateX(-0.28rem);
  transition: opacity 150ms ease, transform 150ms ease;
}
.folder-page .folder-board-card:hover .folder-board-card-open,
.folder-page .folder-board-card:focus-visible .folder-board-card-open {
  opacity: 1;
  transform: translateX(0);
}
.folder-page .folder-board-empty {
  padding: 2.8rem 0.75rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--type-size-meta);
  text-align: center;
}

.folder-page .folder-board-lane.is-filter-empty .folder-board-cards::after {
  content: "No matching notes";
  padding: 2.8rem 0.75rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--type-size-meta);
  text-align: center;
}

.folder-page .folder-board-lane.is-filter-empty .folder-board-card { display: none; }

@media (max-width: 860px) {
  .folder-page .content-panel { padding: 0; }
  .folder-page .folder-summary { width: 100%; max-width: none; }
  body.folder-page:not(.folder-open-page) .folder-summary { padding-top: 10.5rem; }
  .folder-page .folder-appbar { min-height: auto; flex-wrap: wrap; padding-top: 0.7rem; padding-bottom: 0.7rem; }
  .folder-page .folder-app-controls { width: 100%; margin-left: 0; padding-right: 3rem; }
  .folder-page .folder-mobile-browse {
    min-height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.62rem;
    border: var(--border-divider);
    border-radius: 0.48rem;
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    font: 650 0.76rem/1 var(--font-ui);
  }
  .folder-page .folder-mobile-browse:hover,
  .folder-page .folder-mobile-browse[aria-expanded="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
  }
  .folder-page .folder-workspace-search { flex: 1 1 12rem; width: auto; }
  .folder-page .folder-app-nav { padding: 0 0.52rem; }
  .folder-page .folder-contextbar { min-height: 3rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-compact); padding-top: 0.65rem; padding-bottom: 0.65rem; }
  .folder-page .folder-workspace-board-nav { grid-column: 1 / -1; grid-row: 2; }
  .folder-page .folder-context-meta { display: none; }
  .folder-page .folder-board-shell { min-height: calc(100dvh - 10.5rem); padding: 1rem; }
  .folder-page .folder-board-grid { grid-template-columns: repeat(var(--folder-board-column-count, var(--folder-board-lane-count)), minmax(82vw, 1fr)); min-height: 12rem; gap: 0.8rem; padding-bottom: 0.25rem; scroll-snap-type: x mandatory; }
  .folder-page .folder-board-lane { min-height: 12rem; max-height: none; }
  .folder-page .folder-board-add-lane { min-height: 12rem; }
}

/* Full width is a workspace canvas, not a widened document card. Removing
   the outer frame lets the sticky two-row workspace header meet the viewport
   edge, as it does in the board reference. */
:root[data-view="focus"] body.folder-page .layout {
  width: 100vw;
  height: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
}

:root[data-view="focus"] body.folder-page .content-panel {
  height: 100dvh;
  min-height: 100dvh;
  padding: 0;
}

/* The folder board header is fixed to the content workspace. On a normal
   desktop layout the tree owns the left rail; in focus/collapsed mode the
   header expands and the tree becomes an overlay. */
body.folder-page:not(.folder-open-page) .folder-workspace {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  width: 100vw;
  z-index: var(--z-overlay);
}

body.folder-page:not(.folder-open-page) .folder-summary {
  padding-top: 6.8rem;
}

@media (max-width: 860px) {
  body.folder-page:not(.folder-open-page) .folder-summary { padding-top: 10.5rem; }

  /* Folder pages have their own fixed workspace header. Keep the legacy tree
     outside that layout as a proper drawer so it cannot consume a grid row or
     appear underneath the header at tablet widths. */
  body.folder-page .layout > .content-panel {
    grid-column: 1;
    grid-row: 1;
  }
  body.folder-page .sidebar,
  :root[data-view="focus"] body.folder-page .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-popover-top);
    width: min(22rem, calc(100vw - 0.75rem));
    height: 100dvh;
    max-height: 100dvh;
    padding: 0.75rem;
    overflow: auto;
    border: 0;
    border-right: var(--border-surface);
    border-radius: 0 0.8rem 0.8rem 0;
    background: var(--sidebar-bg);
    box-shadow: var(--shadow);
    transform: translateX(calc(-100% - 0.9rem));
    opacity: 0;
    pointer-events: none;
  }
  body.folder-page .sidebar.mobile-nav-open,
  :root[data-view="focus"] body.folder-page .sidebar.mobile-nav-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
}

/* Tags remain a scanable index, not a full-canvas card feed. The header and
   every tag group deliberately share one bounded rail at every viewport. */
body.tags-page .content-panel {
  padding: clamp(1.35rem, 2.5vw, 3rem) clamp(1rem, 3vw, 2.5rem) 3rem;
}

body.tags-page .content-header,
body.tags-page .content-panel > .tag-index-shell {
  width: min(100%, 68rem);
  margin-right: auto;
  margin-left: auto;
}

body.tags-page .tag-index-shell { gap: 1.3rem; }
body.tags-page .tag-index-search { padding: 0.2rem 0 0.1rem; }
body.tags-page .tag-search-shell {
  display: flex;
  align-items: center;
  gap: var(--space-control);
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: var(--border-surface);
  border-radius: var(--radius-popover);
  background: var(--surface-2);
}
body.tags-page .tag-search-shell:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-shadow-tight);
}
body.tags-page .tag-search-icon {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}
body.tags-page .tag-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  outline: none;
}
body.tags-page .tag-index-sections { display: block; }
body.tags-page .tag-index-empty {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
body.tags-page .tag-index-intro { padding: 0.2rem 0 0.1rem; }
body.tags-page .tag-index-intro h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.55rem, 2.5vw, 2rem);
  letter-spacing: -0.032em;
}

body.tags-page .tag-index-intro p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

body.tags-page .tag-section { padding: 0.9rem; }
body.tags-page .tag-note-link { background: color-mix(in srgb, var(--surface-3) 84%, var(--content-bg)); }

@media (max-width: 640px) {
  body.tags-page .content-panel { padding: 1rem 0.9rem 2rem; }
  body.tags-page .content-header,
  body.tags-page .content-panel > .tag-index-shell { width: 100%; }
}

/* The folder overview is the calmer counterpart to the board: it keeps the
   same sticky workspace header, then gives one folder's notes a readable
   three-column canvas. This is deliberately separate from board-lane rules. */
body.folder-open-page .content-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
}

body.folder-open-page .folder-open-shell {
  display: block;
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding-top: 3.75rem;
}

/* The open-folder header is the app bar for this view, not a piece of the
   centered content rail. Promote it above the layout grid so it reaches both
   viewport edges even when the sidebar is collapsed or hidden. */
body.folder-open-page .folder-open-workspace-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  width: 100vw;
  z-index: var(--z-overlay);
}

/* The global display-settings launcher normally sits above the page chrome.
   The full-width folder header is also promoted to the viewport, so retain
   that relationship here instead of letting the header cover the launcher. */
body.folder-page .floating-controls {
  z-index: var(--z-popover);
}

body.folder-open-page .folder-open-workspace-header .folder-appbar {
  min-height: 3.75rem;
}

@media (min-width: 861px) {
  /* Normal view: the sidebar and content header form one two-column app bar. */
  :root[data-view="normal"][data-sidebar="open"] body.folder-page .folder-workspace {
    left: var(--sidebar-width);
    width: calc(100vw - var(--sidebar-width));
  }

  /* A collapsed rail (and focus mode) makes the header full-width. The focus
     sidebar is a drawer and must rise above that header when revealed. */
  :root[data-sidebar="collapsed"] body.folder-page .folder-workspace,
  :root[data-view="focus"] body.folder-page .folder-workspace {
    left: 0;
    width: 100vw;
  }

  :root[data-view="focus"] body.folder-page .sidebar {
    z-index: var(--z-popover-top);
  }
}

body.folder-open-page .folder-open-breadcrumbs {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: 0.25rem;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--type-size-meta);
  font-weight: 630;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.folder-open-page .folder-open-breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

body.folder-open-page .folder-open-breadcrumbs a:hover { color: var(--accent-strong); }

body.folder-open-page .folder-open-content {
  width: min(100%, 48rem);
  max-width: 48rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 3vw, 2.6rem) clamp(1.15rem, 2.35vw, 2rem) 3rem;
}

body.folder-open-page .folder-open-hero {
  padding: 0 0 1.45rem;
  border-bottom: var(--border-divider);
}

body.folder-open-page .folder-open-hero h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: clamp(2rem, 4vw, 2.7rem);
  font-weight: 760;
  letter-spacing: -0.042em;
  line-height: 1.05;
}

body.folder-open-page .folder-open-hero p {
  max-width: 52rem;
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: var(--type-size-default);
  line-height: 1.5;
}

body.folder-open-page .folder-open-sections {
  display: grid;
  gap: 2.8rem;
  padding-top: 0.35rem;
}

body.folder-open-page .folder-open-section {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body.folder-open-page .folder-open-section-header {
  min-height: 0;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 1.2rem 0 0.85rem;
  border-bottom: var(--border-divider);
}

body.folder-open-page .folder-open-section-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

body.folder-open-page .folder-open-section-title strong {
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.folder-open-page .folder-open-section-count {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 620;
}

body.folder-open-page .folder-open-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

body.folder-open-page .folder-note-link,
body.folder-open-page .folder-child-link {
  /* All archive rows share one compact rhythm. Without this, a note with no
     preview image collapses while its neighbour with a preview grows. */
  height: 9rem;
  min-height: 9rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: var(--space-5);
  margin: 0 -0.7rem;
  padding: 1rem 0.7rem;
  border: 1px solid transparent;
  border-bottom-color: var(--separator);
  border-radius: 0.45rem;
  background: transparent;
  box-shadow: none;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

body.folder-open-page .folder-note-link--with-thumbnail {
  /* A preview is useful context, so image rows get one additional rhythm
     unit rather than forcing the image into the text-only row height. */
  height: 10.5rem;
  min-height: 10.5rem;
  grid-template-columns: minmax(0, 1fr) 10rem;
}

/* Preserve the item box on the final row. The base folder list removes that
   row's border completely, which would otherwise remove the hover outline's
   bottom edge. */
body.folder-open-page .folder-open-grid > :last-child {
  border-bottom: 1px solid transparent;
}

body.folder-open-page .folder-note-copy {
  display: grid;
  min-width: 0;
  gap: 0.4rem;
}

body.folder-open-page .folder-note-thumbnail {
  display: block;
  width: 10rem;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-3);
}

body.folder-open-page .folder-note-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

body.folder-open-page .folder-note-link:hover,
body.folder-open-page .folder-note-link:focus-visible,
body.folder-open-page .folder-child-link:hover,
body.folder-open-page .folder-child-link:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--content-bg) 92%, var(--accent-soft));
  box-shadow: none;
  outline: 0;
  color: var(--accent-strong);
  transform: translateY(-1px);
}

body.folder-open-page .folder-note-link:hover .folder-note-thumbnail img,
body.folder-open-page .folder-note-link:focus-visible .folder-note-thumbnail img {
  transform: scale(1.025);
}

body.folder-open-page .note-link-header { gap: var(--space-compact); }

/* Locked rows need a visible status endpoint. The shared badge is deliberately
   compact for metadata; the archive list has enough room for a legible mark. */
body.folder-open-page .folder-note-link .note-lock-badge {
  width: 1.3rem;
  height: 1.3rem;
  color: var(--muted);
  opacity: 1;
}

body.folder-open-page .folder-note-link strong,
body.folder-open-page .folder-child-link strong {
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1.2rem;
  font-weight: 760;
  line-height: 1.25;
}

body.folder-open-page .folder-note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
}

body.folder-open-page .folder-note-tags > span {
  display: inline-flex;
  width: auto;
  padding: 0.24rem 0.5rem;
  border-radius: 0.4rem;
  background: color-mix(in srgb, var(--accent-soft) 88%, var(--surface-3));
  color: var(--accent-strong);
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
}

body.folder-open-page .folder-note-summary {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.48;
  min-height: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.folder-open-page .folder-note-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-compact);
  margin-top: 0.12rem;
  padding: 0;
  border: 0;
  font-family: var(--font-ui);
  line-height: 1.3;
}

body.folder-open-page .folder-note-date {
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 620;
}

body.folder-open-page .folder-note-status {
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Article navigation stays quieter than the folder workspace; the TOC uses a
   rail (not a divider) to describe the active section. */
.note-page .content-header { overflow: visible; }

.note-breadcrumbs {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 620;
  white-space: nowrap;
}

.note-breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.note-breadcrumbs a:hover { color: var(--accent-strong); }
.note-breadcrumbs strong { color: var(--text); font-weight: 700; }

.note-page .note-body a {
  color: var(--accent-strong);
  text-decoration-color: color-mix(in srgb, var(--accent-strong) 58%, transparent);
  text-underline-offset: 0.15em;
}

.note-page .note-body a:hover { color: var(--text); text-decoration-color: currentColor; }

.note-status-published::before { background: var(--success, #57c995); }

.toc-panel { position: relative; }
.toc-group-summary,
.toc-link {
  border-left: 2px solid transparent;
}

.toc-link.is-current,
.toc-group.is-current > .toc-group-summary {
  border-left-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.toc-link.is-current { font-weight: 700; }
.toc-group.is-current > .toc-group-summary .toc-group-label { color: var(--accent-strong); }

@media (min-width: 861px) {
  body.note-page .toc-panel { padding-top: 3.85rem; }
  body.note-page .toc-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3.2rem;
    border-bottom: var(--border-divider);
    background: var(--toc-bg);
  }
  body.note-page .toc-panel > * { position: relative; }
  body.note-page .floating-controls { top: 0.55rem; right: 0.55rem; }
  :root[data-sidebar="collapsed"][data-reading="centered"] .note-page .content-panel > .content-header {
    width: min(100%, 70ch);
    margin-inline: auto;
  }
}

body.folder-open-page .folder-note-open {
  top: 1rem;
  right: 1rem;
  color: var(--accent-strong);
}

@media (max-width: 640px) {
  body.folder-open-page .folder-open-shell { padding-top: 7rem; }
  body.folder-open-page .folder-open-content { padding: 1rem 0.9rem 1.5rem; }
  body.folder-open-page .folder-open-section-header { padding-top: 1rem; }
  body.folder-open-page .folder-note-link,
  body.folder-open-page .folder-child-link {
    height: auto;
    min-height: 0;
    padding: 1.15rem 0;
  }
  body.folder-open-page .folder-note-link--with-thumbnail {
    grid-template-columns: minmax(0, 1fr) 7rem;
    gap: 0.9rem;
  }
  body.folder-open-page .folder-note-thumbnail { width: 7rem; }
  body.folder-open-page .folder-note-link strong,
  body.folder-open-page .folder-child-link strong { font-size: 1.05rem; }
}

/* Mobile folder overviews use the document as their vertical scroll root in
   both Standard and Full modes. The desktop canvas otherwise pins the layout
   to the viewport and makes the content panel an inner scroller, which traps
   touch/wheel scrolling in Brave's mobile viewport. */
@media (max-width: 860px) {
  body.folder-open-page .layout,
  :root[data-view="focus"] body.folder-open-page .layout {
    /* The sidebar is a fixed drawer at this breakpoint, so keep it out of the
       layout grid. A one-column grid can retain the desktop sidebar track in
       Standard mode and leave the visible content panel in a constrained
       track; Focus mode happened to hide that by collapsing the grid. */
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  body.folder-open-page .content-panel,
  :root[data-view="focus"] body.folder-open-page .content-panel {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    overscroll-behavior: auto;
  }
}

/* Keep the wide article mode as one track. This sits after the responsive
   focus rules so they cannot widen only the body and detach it from the hero. */
:root[data-reading="left"] .note-page .content-panel > .content-header,
:root[data-reading="left"] .note-page .content-panel > .note-body {
  width: min(100%, var(--measure-reader-wide)) !important;
  max-width: 72rem;
  margin-inline: auto !important;
}

/* Collapsing navigation cannot silently change only the article header's
   measure; the header and prose remain on the same centered reading track. */
:root[data-sidebar="collapsed"][data-reading="centered"] .note-page .content-panel > .content-header {
  width: min(100%, 46rem) !important;
  margin-inline: auto !important;
}

/* The TOC is a compact, independent reading aid: an anchored surface with
   visible structure, not a second scrolling workspace. */
.toc-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 0.42rem;
}

.toc-panel-header h2 {
  margin: 0;
}

.toc-settings-slot {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

body.note-page .floating-controls.toc-settings-control {
  position: static;
  z-index: auto;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.note-page .floating-controls.toc-settings-control .control-button {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.5rem;
}

.toc-list {
  gap: 0.28rem;
}

.toc-group + .toc-group,
.toc-link + .toc-group,
.toc-group + .toc-link {
  margin-top: 0.28rem;
}

.toc-group-summary {
  gap: 0.48rem;
  padding: 0.34rem 0.46rem;
  font-weight: 650;
  line-height: 1.32;
}

.toc-group-label {
  font-weight: 650;
  line-height: 1.32;
}

.toc-sublist {
  position: relative;
  gap: 0.22rem;
  margin: 0.2rem 0 0.36rem 1rem;
  padding: 0.12rem 0 0.14rem 0.72rem;
  border-left: var(--border-divider);
}

.toc-link {
  margin-left: 0;
  padding: 0.32rem 0.46rem;
  font-weight: 500;
  line-height: 1.35;
}

.toc-group.level-2,
.toc-link.level-2,
.toc-link.level-3,
.toc-link.level-4 {
  margin-left: 0;
}

@media (min-width: 861px) {
  body.note-page .toc-panel {
    position: sticky;
    top: 0.75rem;
    align-self: start;
    height: auto;
    max-height: calc(100vh - 1.5rem);
    margin: 0.75rem 0.75rem 0.75rem 0;
    padding: 0.72rem;
    overflow: auto;
    background: var(--surface-2);
    border: var(--border-surface);
    border-radius: var(--radius-popover);
    box-shadow: var(--shadow-sm);
  }

  body.note-page .toc-panel::before {
    display: none;
  }

  body.note-page .toc-panel > * {
    position: static;
  }

  body.note-page .floating-controls:not(.toc-settings-control) {
    top: 0.55rem;
    right: 0.55rem;
  }
}
