/* Community feed (qw-feed.js). Tokens only: works in light, sepia and dark. */
.fd { width: min(680px, 100%); margin: 0 auto; display: grid; gap: 12px; color: var(--text); }
.fd :is(button, input, textarea) { font: inherit; }

.fd-head { display: grid; gap: 10px; }
.fd-search { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 14px; min-height: 48px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); }
.fd-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.fd-search .qi { width: 20px; height: 20px; color: var(--text-muted); flex: none; }
.fd-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); min-height: 44px; font-size: 1rem; }
.fd-clear { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--surface-hover); color: var(--text); cursor: pointer; }
.fd-clear[hidden] { display: none; }
.fd-crumb { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fd-crumb strong { font-size: 1.05rem; }
.fd-trend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fd-trend-label { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.fd-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid color-mix(in srgb, var(--tone-teal) 35%, transparent); border-radius: var(--radius-pill); background: var(--tone-teal-bg); color: var(--tone-teal-ink); font-weight: 700; cursor: pointer; transition: transform 120ms ease, background 140ms ease; }
.fd-chip:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--tone-teal) 22%, var(--surface)); }
.fd-chip:active { transform: scale(.96); }
.fd-chip small { opacity: .75; font-weight: 700; }

/* composer */
.fd-composer-slot[hidden] { display: none; }
.fd-composer, .fd-signin { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.fd-signin { align-items: center; }
.fd-signin > span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--tone-orange-bg); color: var(--tone-orange-ink); flex: none; }
.fd-signin p { margin: 2px 0 0; color: var(--text-muted); }
.fd-signin .button { margin-left: auto; }
.fd-compose-main { flex: 1; min-width: 0; position: relative; display: grid; gap: 8px; }
.fd-compose-main textarea { width: 100%; min-height: 56px; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 1.05rem; line-height: 1.5; padding: 6px 0; }
.fd-compose-main textarea::placeholder { color: var(--text-muted); }
.fd-compose-bar { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.fd-compose-tools { display: flex; gap: 4px; margin-right: auto; }
.fd-count { font-size: .85rem; font-weight: 700; color: var(--text-muted); min-width: 2.2em; text-align: right; }
.fd-count.near { color: var(--tone-amber-ink); } .fd-count.over { color: var(--bad-text); }
.fd-suggest { position: absolute; left: 0; right: 0; top: 64px; z-index: 5; display: grid; padding: 6px; border: 1px solid var(--glass-border); border-radius: var(--radius-card); background: var(--glass-strong); -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur)); box-shadow: var(--shadow-float); }
.fd-suggest[hidden] { display: none; }
.fd-suggest button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border: 0; border-radius: var(--radius-input); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.fd-suggest button:hover, .fd-suggest button:focus-visible { background: var(--surface-hover); }
.fd-suggest small { display: block; color: var(--text-muted); }
.fd-preview[hidden] { display: none; }
.fd-thumb { position: relative; width: fit-content; max-width: 100%; }
.fd-thumb img { display: block; max-width: 100%; max-height: 260px; border-radius: var(--radius-card); border: 1px solid var(--border); }
.fd-thumb .qb-icon { position: absolute; top: 8px; right: 8px; background: var(--glass-strong); }
.fd-alt { width: 100%; margin-top: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-input); background: var(--bg); color: var(--text); }
.fd-busy { color: var(--text-muted); font-size: .92rem; }

/* new posts pill */
.fd-pill { position: sticky; top: 76px; z-index: 6; justify-self: center; min-height: 40px; padding: 0 18px; border: 0; border-radius: var(--radius-pill); background: var(--accent-fill); color: var(--on-accent-fill); font-weight: 800; box-shadow: var(--shadow-float); cursor: pointer; animation: fdPillIn 240ms cubic-bezier(.16, 1, .3, 1); }
.fd-pill[hidden] { display: none; }
@keyframes fdPillIn { from { opacity: 0; transform: translateY(-8px) scale(.96); } }

/* posts */
.fd-list { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); overflow: hidden; }
.fd-list:empty { display: none; }
.fd-post { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); transition: background 140ms ease; outline: 0; }
.fd-post:last-child { border-bottom: 0; }
.fd-post:hover { background: color-mix(in srgb, var(--surface-hover) 55%, transparent); }
.fd-flash { animation: fdFlash 1.6s ease; }
@keyframes fdFlash { 0%, 60% { background: var(--tone-amber-bg); } }
.fd-reply { padding-left: 28px; }
.fd-focus { padding: 18px 16px; }
.fd-focus .fd-text { font-size: 1.15rem; }
.fd-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.fd-meta { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; line-height: 1.3; }
.fd-name { font-weight: 800; color: var(--text); text-decoration: none; }
a.fd-name:hover { text-decoration: underline; }
.fd-handle, .fd-time, .fd-edited, .fd-dot { color: var(--text-muted); font-size: .92rem; text-decoration: none; }
.fd-time:hover { text-decoration: underline; }
.fd-badge { font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: var(--radius-pill); }
.fd-teacher { background: var(--tone-teal-bg); color: var(--tone-teal-ink); } .fd-admin { background: var(--tone-violet-bg); color: var(--tone-violet-ink); }
.fd-text { margin: 0; white-space: normal; overflow-wrap: anywhere; font-size: 1.02rem; line-height: 1.55; color: var(--text); }
.fd-tag, .fd-mention { color: var(--tone-teal-ink); font-weight: 700; text-decoration: none; }
.fd-tag:hover, .fd-mention:hover { text-decoration: underline; }
.fd-note { margin: 0; padding: 6px 10px; border-radius: var(--radius-input); background: var(--tone-amber-bg); color: var(--tone-amber-ink); font-size: .9rem; }
.fd-img { display: block; width: fit-content; max-width: 100%; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; background: var(--surface-hover); cursor: zoom-in; }
.fd-img img { display: block; width: 100%; max-height: 460px; object-fit: cover; height: auto; }
.fd-zoom { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; border-radius: var(--radius-input); }
.fd-actions { display: flex; align-items: center; gap: 4px; margin: 2px -8px -4px; }
.fd-act { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; min-width: 40px; padding: 0 10px; justify-content: center; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-muted); cursor: pointer; transition: background 140ms ease, color 140ms ease, transform 100ms ease; }
.fd-act .qi { width: 20px; height: 20px; }
.fd-act:hover { background: var(--surface-hover); color: var(--text); }
.fd-act:active { transform: scale(.92); }
.fd-act:first-child:hover { color: var(--tone-teal-ink); }
.fd-like.on { color: var(--tone-rose-ink); } .fd-like.on .qi { fill: currentColor; }
.fd-like:hover { background: var(--tone-rose-bg); color: var(--tone-rose-ink); }
.fd-more-btn { margin-left: auto; }
.fd-end { text-align: center; color: var(--text-muted); margin: 6px 0; }
.fd-more { display: grid; place-items: center; }
.fd-empty, .fd-empty-line { display: grid; justify-items: center; gap: 6px; padding: 36px 20px; text-align: center; color: var(--text-muted); }
.fd-empty strong { color: var(--text); font-size: 1.1rem; }
.fd-empty .qi { width: 34px; height: 34px; color: var(--tone-teal-ink); }
.fd-empty p { margin: 0; max-width: 34ch; }
.fd-skeleton { display: grid; gap: 14px; padding: 16px; }
.fd-skeleton i { display: block; height: 72px; border-radius: var(--radius-card); background: linear-gradient(100deg, var(--surface-hover) 30%, var(--surface) 50%, var(--surface-hover) 70%) 0 0 / 200% 100%; animation: fdShimmer 1.2s linear infinite; }
@keyframes fdShimmer { to { background-position: -200% 0; } }
.fd-thread-reply:empty { display: none; }
.fd-thread-reply { border-bottom: 1px solid var(--border); }
.fd-thread-reply .fd-composer { border: 0; border-radius: 0; background: transparent; }
.fd-results { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.fd-results h3 { margin: 0 0 8px; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.fd-results .fd-post { margin: 0 -16px; }
.fd-person { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--text); text-decoration: none; }
.fd-person small { display: block; color: var(--text-muted); }

/* avatars */
.fd-avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; background: var(--tone-teal-bg); color: var(--tone-teal-ink); font-weight: 800; }
.fd-avatar-s { width: 32px; height: 32px; font-size: .85rem; } .fd-avatar-m { width: 44px; height: 44px; } .fd-avatar-l { width: 56px; height: 56px; font-size: 1.3rem; } .fd-avatar-xl { width: 96px; height: 96px; font-size: 2.2rem; }
.fd-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* the "..." menu: glass, with a solid fallback; on phones it is a bottom sheet */
.fd-menu { position: fixed; z-index: 4000; min-width: 230px; max-width: calc(100vw - 16px); display: grid; gap: 2px; padding: 6px; border: 1px solid var(--glass-border); border-radius: var(--radius-card); background: var(--glass-strong); -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur)); box-shadow: var(--shadow-float); animation: fdMenuIn 160ms cubic-bezier(.16, 1, .3, 1); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .fd-menu { background: var(--surface); } }
@keyframes fdMenuIn { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
.fd-menu button { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--radius-input); background: transparent; color: var(--text); text-align: left; cursor: pointer; font-weight: 600; }
.fd-menu button:hover, .fd-menu button:focus-visible { background: var(--surface-hover); outline: 0; }
.fd-menu button.danger { color: var(--bad-text); }
.fd-menu .qi { width: 20px; height: 20px; flex: none; }
.fd-menu hr { margin: 4px 8px; border: 0; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .fd-menu { left: 8px !important; right: 8px; top: auto !important; bottom: calc(10px + env(safe-area-inset-bottom)); width: auto; max-width: none; padding: 10px; animation: fdSheetIn 220ms cubic-bezier(.16, 1, .3, 1); }
  .fd-menu button { min-height: 52px; font-size: 1rem; }
  .fd-post { padding: 12px; gap: 10px; } .fd-reply { padding-left: 18px; }
  .fd-act { min-width: 44px; min-height: 44px; }
  .fd-signin { flex-wrap: wrap; } .fd-signin .button { margin-left: 0; width: 100%; }
}
@keyframes fdSheetIn { from { opacity: 0; transform: translateY(24px); } }
.fd-report { display: grid; gap: 12px; }
.fd-report p { margin: 0; }
.fd-reasons { display: grid; gap: 6px; }
.fd-reasons label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-input); cursor: pointer; }
.fd-reasons label:has(input:checked) { border-color: var(--accent); background: var(--tone-teal-bg); }
.fd-report textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-input); background: var(--bg); color: var(--text); resize: vertical; }
.fd-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .fd-pill, .fd-menu, .fd-flash, .fd-skeleton i { animation: none; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* the button system styles every <button>; inside the feed these are plain controls, so say so (the :not(#qb) keeps the rules winning) */
.fd-search input:not(#qb) { border: 0 !important; background: transparent !important; box-shadow: none !important; border-radius: 0; padding: 0; }
.fd-menu button:not(#qb) { justify-content: flex-start; text-align: left; background: transparent; border: 0; box-shadow: none; border-radius: var(--radius-input); color: var(--text); }
.fd-menu button:not(#qb):hover, .fd-menu button:not(#qb):focus-visible { background: var(--surface-hover); }
.fd-menu button.danger:not(#qb) { color: var(--bad-text); }
.fd-menu button.danger:not(#qb):hover { background: var(--bad-bg); }
.fd-act:not(#qb) { background: transparent; border: 0; box-shadow: none; color: var(--text-muted); justify-content: center; }
.fd-act:not(#qb):hover { background: var(--surface-hover); color: var(--text); }
.fd-like.on:not(#qb), .fd-like:not(#qb):hover { color: var(--tone-rose-ink); }
.fd-like:not(#qb):hover { background: var(--tone-rose-bg); }
.fd-img:not(#qb) { padding: 0; background: var(--surface-hover); border: 1px solid var(--border); border-radius: var(--radius-card); }
.fd-suggest button:not(#qb) { justify-content: flex-start; text-align: left; background: transparent; border: 0; box-shadow: none; border-radius: var(--radius-input); }
.fd-clear:not(#qb) { background: var(--surface-hover); border: 0; }
