/* Feed extras: save button and folder sheet, sort bar, comment threads, blog link previews, Saved page.
   Loaded on every page. Class prefixes: fp- (feed plus), cm- (comments), sv- (saved page). */

/* ---------- Save button (works in any post action row) ---------- */
.fp-actions{display:flex;align-items:center;gap:4px;margin:-4px 0 -10px -10px}
.fp-save{margin-left:auto;height:44px;padding:0 10px;border:0;border-radius:8px;background:none;color:var(--ink);font-size:14px;font-weight:500;display:inline-flex;align-items:center;gap:6px}
.fp-save svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linejoin:round}
.fp-save:hover{background:var(--paper)}
.fp-save[aria-pressed="true"]{color:var(--accent-deep);font-weight:600}
.fp-save[aria-pressed="true"] svg{fill:var(--accent);stroke:var(--accent)}
.profile-acts .fp-save{margin-right:-10px}

/* ---------- Folder sheet ---------- */
.fp-backdrop{position:fixed;inset:0;z-index:80;background:rgba(20,18,16,.32)}
.fp-sheet{position:absolute;z-index:81;width:300px;max-width:calc(100vw - 24px);padding:14px;border:1px solid var(--hair);border-radius:14px;background:var(--card);box-shadow:var(--lift-lg)}
.fp-sheet.is-bottom{position:fixed;left:0!important;right:0;bottom:0;top:auto!important;width:auto;max-width:none;padding:18px 16px calc(18px + env(safe-area-inset-bottom));border-radius:18px 18px 0 0;max-height:80vh;overflow:auto}
.fp-sheet.is-bottom::before{content:"";display:block;width:40px;height:4px;margin:-6px auto 12px;border-radius:2px;background:var(--hair)}
.fp-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 2px 8px}
.fp-sheet-head h2{font-family:var(--sans);font-size:15px;line-height:20px;font-weight:700;letter-spacing:0}
.fp-x{width:36px;height:36px;margin:-6px -6px -6px 0;border:0;border-radius:8px;background:none;display:inline-flex;align-items:center;justify-content:center;color:var(--muted)}
.fp-x:hover{background:var(--paper);color:var(--ink)}
.fp-x svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.fp-sheet-list{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:2px;max-height:240px;overflow:auto}
.fp-sheet.is-bottom .fp-sheet-list{max-height:none}
.fp-sheet-opt{width:100%;min-height:44px;padding:0 10px;border:0;border-radius:10px;background:none;display:flex;align-items:center;gap:10px;text-align:left;font-size:15px;font-weight:500}
.fp-sheet-opt:hover{background:var(--paper)}
.fp-sheet-opt[aria-pressed="true"]{background:var(--accent-wash);font-weight:600}
.fp-sheet-ico{width:30px;height:30px;flex:none;border-radius:8px;background:var(--stone);display:inline-flex;align-items:center;justify-content:center}
.fp-sheet-opt[aria-pressed="true"] .fp-sheet-ico{background:var(--card)}
.fp-sheet-ico svg,.fp-sheet-check svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.fp-sheet-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fp-sheet-count{font-size:13px;color:var(--muted);font-weight:500}
.fp-sheet-check{width:18px;display:inline-flex;color:var(--accent-deep);visibility:hidden}
.fp-sheet-opt[aria-pressed="true"] .fp-sheet-check{visibility:visible}
.fp-newfolder{margin-top:10px;padding-top:12px;border-top:1px solid var(--hair);display:flex;flex-direction:column;gap:6px}
.fp-newfolder label{font-size:13px;line-height:18px;font-weight:600}
.fp-newfolder-row{display:flex;gap:8px}
.fp-newfolder input{flex:1;min-width:0;height:42px;padding:0 12px;border:1px solid var(--hair);border-radius:10px;background:var(--card);font-size:16px}
.fp-newfolder input:focus{border-color:var(--ink);outline:0}
.fp-newfolder input:focus-visible{outline:3px solid #2B5FA8;outline-offset:1px}
.fp-mini-btn{height:42px;padding:0 16px;border:0;border-radius:10px;background:var(--ink);color:#fff;font-size:15px;font-weight:600}
.fp-mini-btn:hover{color:var(--coral)}
.fp-sheet-note{font-size:13px;color:var(--accent-deep)}
.fp-unsave{margin-top:8px;width:100%;min-height:44px;border:0;border-radius:10px;background:none;color:var(--muted);font-size:14px;font-weight:600}
.fp-unsave:hover{background:var(--paper);color:var(--accent-deep)}

/* ---------- Toast ---------- */
.fp-toast{position:fixed;z-index:90;left:50%;bottom:24px;transform:translate(-50%,16px);opacity:0;pointer-events:none;max-width:calc(100vw - 32px);min-height:48px;padding:6px 8px 6px 18px;border-radius:12px;background:var(--ink);color:#fff;box-shadow:var(--lift-lg);display:flex;align-items:center;gap:14px;font-size:15px;font-weight:500;transition:opacity .18s,transform .18s}
.fp-toast.is-on{opacity:1;transform:translate(-50%,0);pointer-events:auto}
.fp-toast>span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.fp-toast-act{min-height:36px;padding:0 12px;border:0;border-radius:8px;background:rgba(255,255,255,.1);color:var(--coral);font-size:14px;font-weight:700;display:inline-flex;align-items:center;white-space:nowrap}
.fp-toast-act:hover{color:#fff;background:rgba(255,255,255,.18)}
@media (max-width:860px){ .fp-toast{bottom:92px} }

/* ---------- Sort bar ---------- */
.fp-sortbar{margin-top:14px;display:flex;justify-content:flex-end}
.fp-sort{position:relative;display:inline-flex;align-items:center;gap:8px;font-size:14px;color:var(--muted);font-weight:500}
.fp-sort select,.sv-move select{appearance:none;-webkit-appearance:none;height:40px;padding:0 34px 0 14px;border:1px solid var(--hair);border-radius:20px;background:var(--card);color:var(--ink);font-size:14px;font-weight:600;cursor:pointer}
.fp-sort select:hover,.sv-move select:hover{border-color:var(--ink)}
.fp-sort svg,.sv-move svg{position:absolute;right:12px;top:50%;width:16px;height:16px;margin-top:-8px;fill:none;stroke:var(--ink);stroke-width:2;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.fp-sortbar + .feed-list{margin-top:10px}

/* ---------- Blog link previews ---------- */
.linkcard-blog{background:var(--card)}
.linkcard-blog .linkcard-thumb{flex:0 0 168px;width:168px;height:auto;aspect-ratio:16/9;object-fit:cover;background:var(--stone)}
.linkcard-blog .linkcard-text{justify-content:center;gap:4px}
.linkcard-blog .linkcard-text b{font-size:16px;line-height:21px}
@media (max-width:640px){
  .linkcard-blog{flex-direction:column}
  .linkcard-blog .linkcard-thumb{flex:none;width:100%}
  .linkcard-blog .linkcard-text{padding:10px 14px 12px}
  .linkcard-blog .linkcard-text b{font-size:15px;line-height:20px}
}

/* ---------- Comment button and thread ---------- */
[data-comments][aria-expanded="true"]{color:var(--accent-deep)}
[data-comments][aria-expanded="true"] svg{fill:var(--accent-wash);stroke:var(--accent-deep)}
.cm{margin-top:6px;padding-top:14px;border-top:1px solid var(--hair);display:flex;flex-direction:column;gap:12px;animation:cm-in .18s ease-out}
@keyframes cm-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.cm{animation:none}.fp-toast{transition:none}}
.cm-head{font-size:12px;line-height:16px;font-weight:700;letter-spacing:1.2px;text-transform:uppercase;color:var(--muted)}
.cm-list,.cm-replies{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:14px}
.cm-replies{margin-top:12px}
.cm-item{display:flex;align-items:flex-start;gap:10px}
.cm-av{width:34px;height:34px;font-size:12px}
.cm-av-sm{width:28px;height:28px;font-size:11px}
.cm-av-ink{background:var(--ink);color:var(--paper)}
.cm-av-stone{background:var(--stone);color:var(--ink)}
.cm-av-wash{background:var(--accent-wash);color:var(--accent-deep)}
.cm-av-accent{background:var(--accent);color:#fff}
.cm-main{flex:1;min-width:0}
.cm-bubble{padding:9px 14px 11px;border-radius:4px 14px 14px 14px;background:var(--paper)}
.cm-meta{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 8px}
.cm-name{font-size:14px;font-weight:700}
.cm-tag{padding:1px 6px;border-radius:4px;background:var(--stone);font-size:11px;line-height:16px;font-weight:700}
.cm-tag-you{background:var(--accent-wash);color:var(--accent-deep)}
.cm-time{font-size:13px;color:var(--muted)}
.cm-text{margin-top:2px;font-size:15px;line-height:1.45;overflow-wrap:anywhere}
.cm-text:focus{outline:0}
.cm-acts{display:flex;align-items:center;gap:2px;margin:2px 0 0 4px}
.cm-like,.cm-reply-btn{min-height:36px;padding:0 8px;border:0;border-radius:8px;background:none;color:var(--muted);font-size:13px;font-weight:600;display:inline-flex;align-items:center;gap:5px}
.cm-like:hover,.cm-reply-btn:hover{color:var(--ink);background:var(--paper)}
.cm-like svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}
.cm-like[aria-pressed="true"]{color:var(--accent-deep)}
.cm-like[aria-pressed="true"] svg{fill:var(--accent);stroke:var(--accent)}
.cm-like-n:empty{display:none}
.cm-reply-btn[aria-expanded="true"]{color:var(--ink)}
.cm-toggle{margin:4px 0 0 4px;min-height:36px;padding:0 8px 0 0;border:0;background:none;color:var(--ink);font-size:13px;font-weight:700;display:inline-flex;align-items:center;gap:10px}
.cm-toggle:hover{color:var(--accent-deep)}
.cm-toggle-line{width:24px;height:1px;background:var(--hair)}
.cm-form{display:flex;align-items:center;gap:8px}
.cm-reply-form{margin-top:10px}
.cm-input{flex:1;min-width:0;height:42px;padding:0 14px;border:1px solid var(--hair);border-radius:21px;background:var(--card);font-size:16px}
.cm-input:focus{border-color:var(--ink);outline:0}
.cm-input:focus-visible{outline:3px solid #2B5FA8;outline-offset:1px}
.cm-send{height:42px;padding:0 16px;border:0;border-radius:21px;background:var(--ink);color:#fff;font-size:14px;font-weight:600;flex:none}
.cm-send:hover{color:var(--coral)}
.cm-cancel{height:42px;padding:0 6px;border:0;background:none;color:var(--muted);font-size:14px;font-weight:600;flex:none}
.cm-cancel:hover{color:var(--ink)}
.cm-empty{font-size:15px;color:var(--muted)}
@media (max-width:640px){
  .cm-reply-form .cm-av{display:none}
  .cm-reply-form{flex-wrap:wrap}
  .cm-reply-form .cm-input{flex:1 1 100%}
  .cm-reply-form .cm-send{flex:1}
}

/* ---------- Saved page ---------- */
.sv-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.sv-head h1{font-size:clamp(34px,4.4vw,48px);letter-spacing:-.8px}
.sv-head h1 i{color:var(--accent)}
.sv-top-actions{display:none}
.sv-intro{margin-top:8px;color:var(--muted);font-size:16px}
.sv-chips{margin-top:20px;display:flex;flex-wrap:wrap;gap:8px}
.sv-chip{height:40px;padding:0 14px;border:1px solid var(--hair);border-radius:20px;background:var(--card);display:inline-flex;align-items:center;gap:8px;font-size:14px;font-weight:600;max-width:100%}
.sv-chip:hover{border-color:var(--ink)}
.sv-chip svg{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.sv-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:22ch}
.sv-chip-n{min-width:22px;height:22px;padding:0 6px;border-radius:11px;background:var(--stone);font-size:12px;display:inline-flex;align-items:center;justify-content:center}
.sv-chip[aria-pressed="true"]{background:var(--ink);border-color:var(--ink);color:#fff}
.sv-chip[aria-pressed="true"] .sv-chip-n{background:rgba(255,255,255,.18)}
.sv-chip-new{border-style:dashed;color:var(--accent-deep)}
.sv-chip-new[aria-expanded="true"]{border-style:solid;border-color:var(--ink);color:var(--ink)}
.sv-bar{margin-top:16px;padding:16px 18px;border:1px solid var(--hair);border-radius:14px;background:var(--card)}
.sv-folder-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 16px}
.sv-folder-title{display:flex;align-items:center;gap:10px;font-size:28px;line-height:1.1;min-width:0}
.sv-folder-title span{overflow-wrap:anywhere}
.sv-folder-title svg{width:22px;height:22px;flex:none;fill:none;stroke:var(--accent);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.sv-folder-acts{display:flex;gap:4px;margin-right:-8px}
.sv-link{min-height:40px;padding:0 10px;border:0;border-radius:8px;background:none;font-size:14px;font-weight:600;color:var(--ink)}
.sv-link:hover{background:var(--paper)}
.sv-link-red{color:var(--accent-deep)}
.sv-form{display:flex;flex-direction:column;gap:8px}
.sv-label{font-size:13px;line-height:18px;font-weight:600}
.sv-form-row{display:flex;flex-wrap:wrap;gap:8px}
.sv-input{flex:1 1 220px;min-width:0;height:42px;padding:0 14px;border:1px solid var(--hair);border-radius:10px;background:var(--card);font-size:16px}
.sv-input:focus{border-color:var(--ink);outline:0}
.sv-input:focus-visible{outline:3px solid #2B5FA8;outline-offset:1px}
.sv-note{font-size:14px;color:var(--accent-deep)}
.sv-confirm{display:flex;flex-direction:column;gap:6px}
.sv-confirm-q{font-weight:700;font-size:16px;overflow-wrap:anywhere}
.sv-confirm-sub{color:var(--muted);font-size:15px}
.sv-confirm .sv-form-row{margin-top:6px}
.sv-list{margin-top:16px;display:flex;flex-direction:column;gap:16px}
.sv-post{padding:20px 22px;display:flex;flex-direction:column;gap:12px}
.sv-post-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
.sv-post-head .avatar{width:40px;height:40px}
.sv-post-head .topic{margin-left:auto}
.sv-name{font-weight:600}
.sv-time{font-size:14px;color:var(--muted)}
.sv-foot{padding-top:12px;border-top:1px solid var(--hair);display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px}
.sv-where{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--muted);font-weight:500;min-width:0}
.sv-where svg{width:15px;height:15px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.sv-controls{display:flex;align-items:center;gap:8px}
.sv-move{position:relative;display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--muted)}
.sv-move select{max-width:180px}
.sv-remove{height:40px;padding:0 12px;border:1px solid var(--hair);border-radius:20px;background:var(--card);display:inline-flex;align-items:center;gap:6px;font-size:14px;font-weight:600;color:var(--ink)}
.sv-remove:hover{border-color:var(--accent-deep);color:var(--accent-deep)}
.sv-remove svg{width:16px;height:16px;fill:var(--accent);stroke:var(--accent);stroke-width:1.6;stroke-linejoin:round}
.sv-empty{padding:40px 24px;border:1px dashed var(--hair);border-radius:16px;background:var(--card);display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px}
.sv-empty-ico{width:52px;height:52px;border-radius:50%;background:var(--accent-wash);display:flex;align-items:center;justify-content:center;color:var(--accent-deep)}
.sv-empty-ico svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.sv-empty h2{font-size:30px;line-height:1.1}
.sv-empty h2 i{color:var(--accent)}
.sv-empty p{max-width:44ch;color:var(--muted)}
.sv-empty .btn{margin-top:6px}
.sv-side{padding:22px}
.sv-side h2{font-size:24px;line-height:1.1;letter-spacing:0}
.sv-side h2 i{color:var(--accent)}
.sv-side ol{margin:12px 0 0;padding:0;list-style:none;counter-reset:sv;display:flex;flex-direction:column;gap:12px}
.sv-side li{counter-increment:sv;display:flex;gap:12px;font-size:15px;line-height:1.45}
.sv-side li::before{content:counter(sv);width:26px;height:26px;flex:none;border-radius:50%;background:var(--stone);font-size:13px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}
.sv-count{margin-top:4px;font-size:13px;color:var(--muted);font-weight:600}
@media (max-width:1220px){
  .sv-top-actions{display:block}
  body[data-page="app/saved"] .app-rail .app-actions{display:none}
}
@media (max-width:640px){
  .sv-post{padding:16px}
  .sv-bar{padding:14px}
  .sv-folder-title{font-size:24px}
  .sv-controls{width:100%}
  .sv-move{flex:1;min-width:0}
  .sv-move select{max-width:none;width:100%}
  .sv-move > span{flex:none}
  .sv-form-row .btn{flex:1}
}
