/* 左侧栏（2026-10-01 界面改版，登记 F-008）。稿子：docs/mockups/folio-sidebar/s1b-pill.html（A 版）。
   模板 templates/_side.html，行为 js/folio-side.js，数据 app/side.py。
   类名 `fs-` 开头；颜色沿用 folio.css 的 `--fo-` 变量。阅读页不画侧栏，这份样式在那里不起作用。

   版式：侧栏 position:fixed 贴左，body 让出 --fo-sbw；收起（⌘\）后 body 不让位，左上角留一颗 ☰，
   鼠标移到 ☰ 或屏幕左边缘时侧栏浮出来（不占位），点 ☰ 钉回。≤860（手机 / iPad 竖屏）一律是抽屉。 */

:root { --fo-sbw: 264px; --fs-bg: #ececee; --fs-hover: rgba(0,0,0,.05); --fs-press: rgba(0,0,0,.08); }   /* V1 克制：系统侧栏的灰 */
/* 861–1100（折叠屏展开、大屏手机横放、iPad 横屏）侧栏常驻但屏幕不宽，默认收窄到 224 给正文让地方（2026-10-01）；
   224 是顶上一排（首页药丸 + 3 图标 + 搜索）不挤的下限，208 时药丸已贴边。自己拖过宽度的（行内 --fo-sbw）照旧。 */
@media (min-width: 861px) and (max-width: 1100px) { :root { --fo-sbw: 224px; } }

/* ---------------------------------------------------------------- 外框：给侧栏让位 */
html.fo-side-on body { padding-left: var(--fo-sbw); transition: padding-left .26s var(--fo-ease); }
html.fo-side-on.fs-collapsed body { padding-left: 0; }
html.fs-instant body, html.fs-instant .fs, html.fs-instant .fs-scrim { transition: none !important; }
html.fs-resizing, html.fs-resizing * { cursor: col-resize !important; user-select: none; }
html.fs-resizing body { transition: none; }

/* 原来各页给悬浮顶栏让的 60–90px 上边距：顶栏没了，收回来；收起 / 窄屏时左上角那颗 ☰ 要留地方 */
html.fo-side-on .fo-scroll { padding-top: 36px; }
html.fo-side-on .home-main { padding-top: 40px; }
html.fo-side-on .page-scroll { padding-top: 0; }
html.fo-side-on .ff-nb .ff-scroll { padding-top: 28px; }
html.fo-side-on.fs-collapsed .fo-scroll, html.fo-side-on.fs-collapsed .home-main { padding-top: 64px; }
html.fo-side-on.fs-collapsed .page-scroll, html.fo-side-on.fs-collapsed .ff-nb .ff-scroll { padding-top: 52px; }

/* ---------------------------------------------------------------- 侧栏本体 */
.fs { position: fixed; z-index: 45; left: 0; top: 0; bottom: 0; width: var(--fo-sbw); display: flex; flex-direction: column; min-height: 0;
  background: var(--fs-bg); border-right: 1px solid var(--fo-line); color: var(--fo-body); font: 14px/1.5 var(--fo-font);
  -webkit-font-smoothing: antialiased; transition: transform .26s var(--fo-ease); }
.fs .ico { width: 16px; height: 16px; flex: none; }
.fs button, .fs input { font-family: inherit; }
.fs a { color: inherit; text-decoration: none; }
html.fs-collapsed .fs { top: 58px; bottom: 10px; left: 8px; border: 1px solid var(--fo-line-2); border-radius: 14px; box-shadow: var(--fo-shadow-3);
  transform: translateX(calc(-100% - 16px)); }
html.fs-collapsed.fs-peek .fs { transform: none; }
/* 收起 / 抽屉关着时侧栏是真的藏起来（visibility + JS 里的 inert）：Tab 键不会走进屏幕外的侧栏，
   tools/responsive_check.py 也不会把它当成「固定控件出界」。visibility 延后到滑出动画结束再切。 */
html.fs-collapsed .fs { visibility: hidden; transition: transform .26s var(--fo-ease), visibility 0s .26s; }
html.fs-collapsed.fs-peek .fs { visibility: visible; transition: transform .26s var(--fo-ease); }
.fs-edge { display: none; position: fixed; z-index: 44; left: 0; top: 58px; bottom: 0; width: 10px; }
html.fs-collapsed .fs-edge { display: block; }
.fs-open { display: none; position: fixed; z-index: 43; left: 12px; top: 12px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px;
  place-items: center; background: var(--fo-surface); box-shadow: var(--fo-shadow); color: var(--fo-ink); cursor: pointer; }
.fs-open .ico { width: 18px; height: 18px; }   /* z 43：在抽屉（45）和遮罩（44）下面，抽屉打开时不压在头像上 */
.fs-open:hover { background: var(--fo-fill); }
html.fs-collapsed .fs-open { display: grid; }
.fs-scrim { position: fixed; inset: 0; z-index: 44; background: rgba(20,18,14,.22); opacity: 0; pointer-events: none; transition: opacity .22s; }
.fs-rz { position: absolute; top: 0; bottom: 0; right: -4px; width: 8px; cursor: col-resize; z-index: 2; }
.fs-rz::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .15s; }
.fs-rz:hover::after, html.fs-resizing .fs-rz::after { background: color-mix(in srgb, var(--fo-accent) 45%, transparent); }
html.fs-collapsed .fs-rz { display: none; }

/* 顶行：头像（账号菜单）+ 收起 */
.fs-top { display: flex; align-items: center; gap: 2px; height: 50px; padding: 0 8px 0 12px; flex: none; }
.fs-me { position: relative; min-width: 0; }
#fo-side #me-toggle { display: flex; align-items: center; gap: 8px; width: auto; height: 32px; margin-left: -3px; padding: 0 7px 0 3px; border: 0; border-radius: 9px;
  background: none; color: var(--fo-ink); font-size: 14.5px; font-weight: 600; min-width: 0; max-width: 190px; cursor: pointer; transform: none; }
#fo-side #me-toggle:hover, #fo-side #me-toggle[aria-expanded="true"] { background: var(--fs-hover); }
.fs-ava { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; }
.fs-ava-blank { display: inline-grid; place-items: center; background: linear-gradient(135deg, #ffb37a, #ff6f91); color: #fff; font-size: 12px; font-weight: 600; }
#fo-side #me-toggle .fs-chev { width: 13px; height: 13px; color: var(--fo-mute); }
#me-panel.fs-me-menu { left: 0; right: auto; top: calc(100% + 6px); transform: none; opacity: 1; visibility: visible; transition: none; }
#me-panel.fs-me-menu[hidden] { display: none; }
.fs-ib { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--fo-mute); cursor: pointer; flex: none; }
.fs-ib:hover { background: var(--fs-hover); color: var(--fo-ink); }

.fs kbd, .fs-pal kbd { font: 500 11px/1 var(--fo-font); color: var(--fo-faint); padding: 3px 5px; border-radius: 5px; background: var(--fs-hover); }

/* 顶上一排（第三轮，照 Notion）：当前项「图标 + 字」、其余只有图标，最右是搜索。图标 D「粗线圆润」（icons.svg 的 fs-*，线宽 2.2） */
.fs-row { display: flex; align-items: center; gap: 2px; height: 40px; padding: 0 10px; margin-bottom: 8px; flex: none; }
.fs-t { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; min-width: 32px; padding: 0 7px; border: 0; border-radius: 10px;
  background: none; color: var(--fo-mute); font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; }
.fs-t .ico { width: 19px; height: 19px; }
.fs-t span { display: none; }
.fs-t:hover { background: var(--fs-hover); color: var(--fo-ink); }
.fs-t.is-on { background: var(--fs-press); color: var(--fo-ink); padding: 0 11px 0 9px; }
.fs-t.is-on span { display: inline; }
.fs-t:focus-visible { outline: 2px solid var(--fo-accent); outline-offset: 1px; }
.fs-t-search { margin-left: auto; }

/* 底部「问 Folio」（照 Notion 的 New chat） */
.fs-foot { display: flex; padding: 8px 10px 12px; flex: none; }
.fs-ask { flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border-radius: 999px; background: var(--fo-surface);
  box-shadow: 0 0 0 1px var(--fo-line), 0 1px 3px rgba(0,0,0,.05); color: var(--fo-ink); font-size: 14px; font-weight: 600; }
.fs-ask:hover { box-shadow: 0 0 0 1px var(--fo-line-2), 0 4px 12px -6px rgba(0,0,0,.18); }
.fs-ask.is-on { box-shadow: 0 0 0 1.5px var(--fo-ink); }
.fs-ask .ico { width: 17px; height: 17px; }

/* 内容区 */
.fs-body { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 8px 14px; scrollbar-width: thin; overscroll-behavior: contain; }
.fs-body > * + * { margin-top: 12px; }
.fs-sct-hr { display: flex; align-items: center; gap: 2px; }
.fs-sct-hr .fs-sct-h { flex: 1 1 0; }
.fs-sct-act { width: 26px; height: 26px; opacity: 0; transition: opacity .12s; }
.fs-sct-act .ico { width: 15px; height: 15px; }
.fs-sct-hr:hover .fs-sct-act, .fs-sct-act:focus-visible, .fs-sct-act.is-on { opacity: 1; }
.fs-sct-act.is-on { background: var(--fs-press); color: var(--fo-ink); }
.fs-body > .fs-it + .fs-it { margin-top: 0; }
.fs-it { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 0 6px; border: 0; border-radius: 8px; background: none;
  color: var(--fo-body); font-size: 14px; text-align: left; min-width: 0; cursor: pointer; }
.fs-it:hover { background: var(--fs-hover); color: var(--fo-ink); }
.fs-it.is-on { background: var(--fs-press); color: var(--fo-ink); font-weight: 600; }
.fs-it > .ico { width: 17px; height: 17px; margin: 0 2px; color: var(--fo-mute); }
.fs-it.is-on > .ico { color: var(--fo-ink); }
.fs-it em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--fo-mute); font-weight: 500; flex: none; padding-left: 6px; }
.fs-it > .fo-sq { margin: 0 5px; }
.fs-it > .fs-pic { width: 15px; height: 15px; margin: 0 3px; }
.fs-muted { color: var(--fo-mute); }
.fs-sct-h { display: flex; align-items: center; gap: 4px; width: 100%; height: 28px; padding: 0 6px; border: 0; border-radius: 7px; background: none;
  font-size: 12.5px; font-weight: 500; color: var(--fo-mute); text-align: left; cursor: pointer; }
.fs-sct-h:hover { background: var(--fs-hover); }
.fs-sct-h .ico { width: 13px; height: 13px; opacity: 0; transition: opacity .15s, transform .2s var(--fo-ease); }
.fs-sct-h:hover .ico, .fs-sct-h:focus-visible .ico { opacity: .8; }
.fs-sct.is-shut .fs-sct-h .ico { transform: rotate(-90deg); opacity: .8; }
.fs-sct.is-shut .fs-sct-b { display: none; }
.fs-hint { margin: 0; padding: 4px 8px 2px; font-size: 12.5px; color: var(--fo-faint); font-style: italic; }

/* 项目行：项目图标 / 色块 + 名字（2026-10-01 起不再展开文件树）
   动效 E + C（稿子 project-list-motion.html E+C、project-icon-c.html 方案 1）：
   · E：当前项的灰底是一块 .fs-sel，换项目时从上一个项目的位置滑过来（带一点回弹，340ms），JS 在 folio-side.js；
   · C：悬停时色块放大 1.22 / 图标 1.15、名字右移 2px（回弹 280ms）；当前项的色块拉长成小药片，图标后面浮出项目色 16% 的淡底。
   色块和图标都占同样宽的位，选中前后名字不左右跳。 */
.fs-plist { position: relative; }
.fs-sel { position: absolute; left: 0; right: 0; top: 0; height: 30px; border-radius: 8px; background: var(--fs-press); opacity: 0; pointer-events: none; z-index: 0;
  transition: transform .34s cubic-bezier(.34,1.45,.64,1), opacity .2s; }
.fs-sel.show { opacity: 1; }
.fs-plist.has-sel .fs-proj.is-on { background: none; }
.fs-proj { z-index: 1; }
.fs-proj > span { transition: transform .28s cubic-bezier(.34,1.45,.64,1); }
.fs-proj > .fo-sq.fs-face { width: 11px; height: 11px; border-radius: 3.5px; margin: 0 9px 0 6px;
  transition: transform .28s cubic-bezier(.34,1.45,.64,1), width .28s cubic-bezier(.34,1.45,.64,1), margin .28s cubic-bezier(.34,1.45,.64,1), border-radius .28s; }
.fs-proj > .fs-pic.fs-face { box-sizing: border-box; width: 24px; height: 24px; padding: 4px; margin: 0 2px 0 0; border-radius: 7px;
  transition: transform .28s cubic-bezier(.34,1.45,.64,1), background .25s; }
.fs-proj.is-on > .fo-sq.fs-face { width: 16px; border-radius: 5px; margin-right: 4px; }
.fs-proj.is-on > .fs-pic.fs-face { background: color-mix(in srgb, currentColor 16%, transparent); }
@media (hover: hover) {
  .fs-proj:hover > .fo-sq.fs-face { transform: scale(1.22); }
  .fs-proj:hover > .fs-pic.fs-face { transform: scale(1.15); }
  .fs-proj:hover > span { transform: translateX(2px); }
}
/* 跨页面过渡（@view-transition 写在 _side.html 里，只有带侧栏的页面开）：
   侧栏整块单独一层、不做淡入淡出（不然点一下整条侧栏会闪）；正文 180ms 淡入；
   当前项灰底 .fs-sel 单独一层，浏览器自己把它从旧位置挪到新位置（340ms 回弹，和 E 稿子一样）。 */
.fs { view-transition-name: fo-side; }
.fs-sel.show { view-transition-name: fo-sel; }
::view-transition-old(fo-side), ::view-transition-new(fo-side) { animation: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
::view-transition-group(fo-sel) { animation-duration: .34s; animation-timing-function: cubic-bezier(.34,1.45,.64,1); }
::view-transition-old(fo-sel) { animation: none; opacity: 0; }
::view-transition-new(fo-sel) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .fs-sel, .fs-proj > span, .fs-proj > .fs-face { transition: none !important; }
  .fs-proj:hover > span, .fs-proj:hover > .fs-face { transform: none !important; }
}

/* 日程：月历 + 按项目 */
.fs-cal { margin: 4px 2px 0; padding: 12px 12px 8px; border-radius: 16px; background: var(--fo-surface); box-shadow: var(--fo-shadow); }
.fs-cal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; padding-left: 4px; font-size: 14px; font-weight: 650; color: var(--fo-ink); }
.fs-cal-h .fs-ib { width: 24px; height: 24px; }
.fs-cal-g { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); text-align: center; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.fs-cal-g .w { height: 24px; display: grid; place-items: center; color: var(--fo-faint); font-size: 11px; }
.fs-cal-g a { position: relative; display: grid; place-items: center; height: 30px; border-radius: 9px; color: var(--fo-body); }
.fs-cal-g a:hover { background: var(--fo-fill); }
.fs-cal-g .is-sel { background: var(--fo-fill-2); color: var(--fo-ink); font-weight: 700; }
.fs-cal-g .is-today { background: var(--fo-fill-3); color: var(--fo-ink); font-weight: 700; }
.fs-cal-g .is-today:hover { background: var(--fo-fill-3); }
.fs-cal-g .has::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--fo-mute); }
.fs-cal-g .is-today.has::after { background: var(--fo-ink); }
.fs-pf { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 8px; border: 0; border-radius: 8px; background: none; font-size: 14px;
  color: var(--fo-body); text-align: left; cursor: pointer; min-width: 0; }
.fs-pf:hover { background: var(--fs-hover); color: var(--fo-ink); }
.fs-box { width: 16px; height: 16px; border-radius: 4.5px; border: 1.6px solid var(--pc); display: grid; place-items: center; flex: none; }
.fs-pf.is-on .fs-box { background: var(--pc); }
.fs-pf.is-on .fs-box::after { content: ""; width: 3px; height: 7px; border: solid #fff; border-width: 0 1.6px 1.6px 0; transform: translateY(-1px) rotate(45deg); }
.fs-pf em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--fo-faint); }

/* ---------------------------------------------------------------- ⌘K：搜索或问 Folio */
.fs-pal { position: fixed; inset: 0; z-index: 120; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; background: rgba(20,18,14,.2); font-family: var(--fo-font); }
.fs-pal[hidden] { display: none; }
.fs-pal-box { width: min(620px, 100%); background: var(--fo-surface); border-radius: 18px; box-shadow: var(--fo-shadow-3); overflow: hidden; }
.fs-pal-in { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 16px; border-bottom: 1px solid var(--fo-line); color: var(--fo-mute); }
.fs-pal-in .ico { width: 17px; height: 17px; }
.fs-pal-in input { flex: 1 1 0; min-width: 0; border: 0; outline: 0; background: none; font: 16px var(--fo-font); color: var(--fo-ink); }
.fs-pal-list { max-height: min(420px, 58vh); overflow-y: auto; padding: 6px; }
.fs-pal-g { padding: 8px 10px 4px; font-size: 11.5px; color: var(--fo-faint); }
.fs-pal-it { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: 10px; min-width: 0; color: var(--fo-ink); text-decoration: none; font-size: 14px; }
.fs-pal-it .ico { width: 16px; height: 16px; color: var(--fo-mute); flex: none; }
.fs-pal-it.is-sel { background: var(--fo-fill); }
.fs-pal-it .fs-where { margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--fo-faint); white-space: nowrap; flex: none; }
.fs-pal-it.is-ai .ico { color: var(--fo-ink); }
.fs-pal-empty { padding: 20px; text-align: center; color: var(--fo-mute); font-size: 13.5px; }

/* ---------------------------------------------------------------- 项目图标和颜色选择器（项目页标题前那颗按钮） */
.fs-ipk { position: fixed; z-index: 110; width: min(312px, calc(100vw - 16px)); padding: 12px 12px 14px; border-radius: 16px; background: var(--fo-surface);
  border: 1px solid var(--fo-line); box-shadow: var(--fo-shadow-3); font-family: var(--fo-font); }
.fs-ipk-h { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 8px; font-size: 12px; color: var(--fo-faint); }
.fs-ipk-x { border: 0; background: none; padding: 3px 7px; border-radius: 6px; font-size: 12px; color: var(--fo-mute); cursor: pointer; }
.fs-ipk-x:hover { background: var(--fo-fill); color: var(--fo-ink); }
.fs-ipk-g { display: grid; grid-template-columns: repeat(8, minmax(0,1fr)); gap: 3px; margin-bottom: 12px; }
.fs-ipk-g button { display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 0; border-radius: 9px; background: none; cursor: pointer; }
.fs-ipk-g button:hover { background: var(--fo-fill); }
.fs-ipk-g .is-on { background: var(--fo-fill-2); }
.fs-ipk-g .ico { width: 18px; height: 18px; }
.fs-ipk-c { display: grid; grid-template-columns: repeat(10, minmax(0,1fr)); gap: 7px; padding: 0 2px; }
.fs-ipk-c button { aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); cursor: pointer; }
.fs-ipk-c .is-on { box-shadow: 0 0 0 2px var(--fo-surface), 0 0 0 4px var(--c); }
.fs-ipk .fo-err { margin: 8px 2px 0; font-size: 12.5px; color: var(--fo-danger); }
.fs-ipk .fo-err:empty { display: none; }

/* ---------------------------------------------------------------- 没有悬停的设备：三角常驻 */
@media (hover: none) {
  .fs-sct-h .ico { opacity: .8; }
  .fs-sct-act { opacity: 1; }
}
/* ---------------------------------------------------------------- 窄屏（手机 / iPad 竖屏）：抽屉 */
@media (max-width: 860px) {
  html.fo-side-on body, html.fo-side-on.fs-collapsed body { padding-left: 0; }
  .fs, html.fs-collapsed .fs { top: 0; bottom: 0; left: 0; width: min(80vw, 272px); border: 0; border-right: 1px solid var(--fo-line); border-radius: 0;
    box-shadow: none; transform: translateX(-102%); }
  .fs, html.fs-collapsed .fs { visibility: hidden; transition: transform .26s var(--fo-ease), visibility 0s .26s; }
  html.fs-drawer .fs { transform: none; box-shadow: var(--fo-shadow-3); visibility: visible; transition: transform .26s var(--fo-ease); }
  html.fs-drawer .fs-scrim { opacity: 1; pointer-events: auto; }
  .fs-open { display: grid; }
  .fs-rz, .fs-edge { display: none !important; }
  .fs-it, .fs-pf { min-height: 38px; }
  .fs-t { height: 36px; min-width: 36px; }
  html.fo-side-on .fo-scroll, html.fo-side-on .home-main { padding-top: 64px; }
  html.fo-side-on .page-scroll, html.fo-side-on .ff-nb .ff-scroll { padding-top: 52px; }
}
