source: Klonkt/src/views/pages/post.ejs@ 0403187

main
Last change on this file since 0403187 was 0403187, checked in by roboburr <roboburr@…>, 2 months ago

feat(fediverse): host your own polls (federate as AS2 Question)

A post can carry a poll that federates as an AS2 Question so remote (Mastodon)
followers vote from their own app; votes are tallied server-side and the fresh
counts are pushed back as Update(Question). Voting is fediverse-only; the site
shows live, read-only results. Complements the existing inbound poll support.

  • src/config/database.js — posts.poll_json (our poll definition) + poll_votes table (post_id, actor_uri, choice; UNIQUE) backing the tally + per-actor dedupe.
  • src/services/ActivityPubService.js — parseOwnPoll/pollTally/ownPollView helpers; buildNote emits a Question (oneOf/anyOf + replies.totalItems + endTime/closed + votersCount) for a poll post; handleInbox records a ballot (Note with name + inReplyTo our poll) before the reply path, deduped per actor; a debounced Update(Question) pushes fresh counts to followers; votersCount added to AP_CONTEXT.
  • src/services/Scheduler.js — closeExpiredPolls() marks a poll closed once its endTime passes and pushes the final tally; runs on the existing 60s tick.
  • src/routes/posts.js — parsePollForm() turns the editor fields into poll_json on create/save (a poll with votes is frozen), passes poll_json to the federation hooks, and hands the post page a render-ready ownPollView.
  • src/views/pages/post-edit.ejs — poll section (options, multiple-choice, duration); disabled once the poll has votes.
  • src/views/pages/post.ejs — display-only poll with result bars + voter/close meta.
  • src/services/i18n.js — poll.* + pedit.poll_* strings (nl/en/de).
  • test/polls.test.js — Question shape, tally, percentages, closed state, AS2 term.
  • CHANGELOG(.nl/.de).md — "Create your own polls" under Unreleased.

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 27.1 KB
Line 
1<%
2// In hub mode the site is accessible under /user/<slug>; all site-scoped links
3// (tag, edit, delete, comments) must carry that prefix otherwise they fall back
4// to the primary site → 404 / wrong site. In solo mode _base = ''.
5const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
6%>
7<article class="container post-page<%= post.nsfw ? ' nsfw-gate' : '' %>">
8
9 <%# Navigation across ALL posts — ABOVE the post (shared partial). %>
10 <%- include('../partials/post-nav', { newerPost: newerPost, olderPost: olderPost }) %>
11
12 <% if (post.nsfw) { %>
13 <div class="nsfw-banner">
14 <span class="nsfw-banner-icon">🔞</span>
15 <span class="nsfw-banner-text"><%= post.content_warning || t('post.nsfw_warning') %></span>
16 <button type="button" class="nsfw-banner-btn nsfw-reveal"><%= t('post.nsfw_show') %></button>
17 </div>
18 <% } %>
19
20 <% if (post.cover_image_url) { %>
21 <figure class="post-cover">
22 <img src="<%= post.cover_image_url %>" alt=""<% if (post.cover_video_url) { %> data-ios-mp4="<%= post.cover_video_url %>"<% } %>>
23 </figure>
24 <% } %>
25
26 <header class="post-header">
27 <h1 class="post-title"><%= post.title %></h1>
28 <div class="post-meta">
29 <a class="author" href="/users/<%= encodeURIComponent(post.author_username) %>"
30 hx-get="/users/<%= encodeURIComponent(post.author_username) %>?partial=1"
31 hx-target="#pcms-main" hx-swap="innerHTML"
32 hx-push-url="/users/<%= encodeURIComponent(post.author_username) %>"
33 hx-indicator="#pcms-loading"><%= post.author_username %></a>
34 <span class="meta-sep">·</span>
35 <time datetime="<%= post.published_at || post.created_at %>"><%= formatDate(post.published_at || post.created_at) %></time>
36 <% if (post.status !== 'published') { %>
37 <span class="meta-sep">·</span>
38 <span class="status-badge status-<%= post.status %>"><%= post.status %></span>
39 <% } %>
40 </div>
41 </header>
42
43 <div class="post-content">
44 <%- post.content_html %>
45 </div>
46
47 <% if (typeof poll !== 'undefined' && poll) { %>
48 <section class="poll" aria-label="<%= t('poll.aria') %>">
49 <% poll.options.forEach(function(o){ var _lead = poll.total > 0 && o.count === Math.max.apply(null, poll.options.map(function(x){return x.count;})); %>
50 <div class="poll-opt<%= _lead ? ' is-lead' : '' %>">
51 <div class="poll-bar" style="width:<%= o.pct %>%"></div>
52 <span class="poll-name"><%= o.name %></span>
53 <span class="poll-pct"><%= o.pct %>%</span>
54 </div>
55 <% }); %>
56 <div class="poll-meta">
57 <span><%= poll.voters %> <%= poll.voters === 1 ? t('poll.voter_one') : t('poll.voter_many') %></span>
58 <span aria-hidden="true">·</span>
59 <% if (poll.closed) { %>
60 <span><%= t('poll.closed') %></span>
61 <% } else if (poll.endTime) { %>
62 <span><%= t('poll.closes') %> <%= new Date(poll.endTime).toLocaleString() %></span>
63 <% } %>
64 <% if (poll.multiple) { %><span aria-hidden="true">·</span><span><%= t('poll.multiple') %></span><% } %>
65 </div>
66 <p class="poll-note"><%= t('poll.fedi_only') %></p>
67 </section>
68 <% } %>
69
70 <% if (post.tags && post.tags.length > 0) { %>
71 <div class="post-tags">
72 <% post.tags.forEach(t => { %>
73 <a class="tag" href="<%= _base %>/tag/<%= encodeURIComponent(t) %>"
74 hx-get="<%= _base %>/tag/<%= encodeURIComponent(t) %>?partial=1"
75 hx-target="#pcms-main" hx-swap="innerHTML"
76 hx-push-url="<%= _base %>/tag/<%= encodeURIComponent(t) %>"
77 hx-indicator="#pcms-loading">#<%= t %></a>
78 <% }); %>
79 </div>
80 <% } %>
81
82 <div class="post-share" style="margin:1.25rem 0;display:flex;align-items:center;gap:.6rem;flex-wrap:wrap">
83 <button type="button" class="btn post-share-btn" data-share data-share-title="<%= post.title %>">🔗 <%= t('post.share') %></button>
84 <span class="post-share-feedback" id="post-share-feedback" style="color:var(--accent);font-size:.85rem" hidden><%= t('post.share_copied') %></span>
85 </div>
86
87 <!-- Inline admin actions: only visible if user has permission -->
88 <% if (user && (permissions.canEditPost(user, post, site) || permissions.canDeletePost(user, post, site))) { %>
89 <aside class="post-actions">
90 <% if (permissions.canEditPost(user, post, site)) { %>
91 <a href="<%= _base %>/posts/<%= post.slug %>/edit" class="btn"
92 hx-get="<%= _base %>/posts/<%= post.slug %>/edit?partial=1" hx-target="#pcms-main"
93 hx-push-url="<%= _base %>/posts/<%= post.slug %>/edit" hx-indicator="#pcms-loading">
94 ✏️ Edit
95 </a>
96 <% } %>
97 <% if (permissions.canDeletePost(user, post, site)) { %>
98 <form method="post" action="<%= _base %>/posts/<%= post.slug %>/delete" style="display:inline" data-confirm="Delete this post?">
99 <button type="submit" class="btn btn-danger">🗑 Delete</button>
100 </form>
101 <% } %>
102 </aside>
103 <% } %>
104
105 <!-- Fediverse interactions — single place: ⭐ like (clickable) + 🔁/💬 counts + reply -->
106 <% var _postAbsUrl = (typeof ogOrigin !== 'undefined' && ogOrigin ? ogOrigin : '') + (typeof _base !== 'undefined' && _base ? _base : '') + '/' + post.slug; %>
107 <% var _fedi = (typeof fediverse !== 'undefined' && fediverse) ? fediverse : { thread: [], likeCount: 0, announceCount: 0 }; %>
108 <% if (post.status === 'published' && (typeof apEnabled === 'undefined' || apEnabled)) { %>
109 <section class="post-fediverse post-comments" id="fediverse">
110 <h2 class="comments-heading"><%= t('fedi.heading') %></h2>
111 <div class="fedi-stats">
112 <span class="fedi-stat" title="<%= t('fedi.likes') %>">
113 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>
114 <span><%= _fedi.likeCount %></span>
115 </span>
116 <span class="fedi-stat" title="<%= t('fedi.boosts') %>">
117 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>
118 <span><%= _fedi.announceCount %></span>
119 </span>
120 <span class="fedi-stat" title="<%= t('fedi.replies') %>">
121 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
122 <span><%= (_fedi.thread || []).length %></span>
123 </span>
124 </div>
125 <% if (_fedi.thread && _fedi.thread.length) { %>
126 <ol class="comments-list">
127 <% _fedi.thread.forEach(function(n){ %>
128 <li class="comment"><%- include('../partials/fedi-node', { n: n, t: t, canManageSite: (typeof canManageSite !== 'undefined' ? canManageSite : false), _base: _base, siteAvatar: (typeof siteAvatar !== 'undefined' ? siteAvatar : null), formatDateTime: formatDateTime, postSlug: post.slug }) %></li>
129 <% }); %>
130 </ol>
131 <% } %>
132 <%# "Interact via the fediverse" is for VISITORS (reply from their own server).
133 The owner/admin has their own controls + it's their post → hide it for them. %>
134 <% if (typeof canManageSite === 'undefined' || !canManageSite) { %>
135 <div class="post-fediverse-cta">
136 <button type="button" class="btn fedi-remote-reply-btn" data-fedi-uri="<%= _postAbsUrl %>" data-fedi-ph="<%= t('fedi.remote_ph') %>">
137 <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>
138 <%= t('fedi.remote_interact') %>
139 </button>
140 </div>
141 <% } %>
142 </section>
143 <% } %>
144 <script>
145 (function(){
146 if (window.__fediRemoteWired) return; window.__fediRemoteWired = true;
147 var current = null, currentBtn = null;
148 function close(){ if (current) { current.remove(); current = null; currentBtn = null; } }
149 function go(raw, uri){
150 var d = (raw||'').trim().replace(/^@?[^@\s]*@/, '').replace(/^https?:\/\//i, '').replace(/\/.*$/, '').trim();
151 if (d) { try { localStorage.setItem('pcmsFediServer', d); } catch(e){} location.href = 'https://' + d + '/authorize_interaction?uri=' + encodeURIComponent(uri||''); }
152 }
153 function place(f, b){
154 var r = b.getBoundingClientRect();
155 f.style.top = (r.bottom + window.scrollY + 6) + 'px';
156 f.style.left = Math.max(8, Math.min(r.left + window.scrollX, window.scrollX + window.innerWidth - 340)) + 'px';
157 }
158 document.addEventListener('click', function(e){
159 if (e.target.closest && e.target.closest('.fedi-remote-cancel')) { close(); return; }
160 if (current && e.target.closest && e.target.closest('.fedi-remote-form')) return; // click inside → keep
161 var b = e.target.closest && e.target.closest('.fedi-remote-reply-btn');
162 if (b) {
163 e.preventDefault();
164 if (currentBtn === b) { close(); return; } // toggle off
165 close();
166 var f = document.createElement('form');
167 f.className = 'fedi-remote-form';
168 f.dataset.uri = b.getAttribute('data-fedi-uri') || '';
169 f.innerHTML = '<input type="text" autocomplete="off" spellcheck="false">'
170 + '<button type="submit" class="btn btn-primary fedi-remote-go" aria-label="ok">&rarr;</button>'
171 + '<button type="button" class="fedi-remote-cancel" aria-label="x">&times;</button>';
172 var _inp = f.querySelector('input');
173 _inp.placeholder = b.getAttribute('data-fedi-ph') || 'mastodon.social';
174 try { var _sv = localStorage.getItem('pcmsFediServer'); if (_sv) _inp.value = _sv; } catch(e){}
175 document.body.appendChild(f); // floating popover → no layout reflow
176 place(f, b); current = f; currentBtn = b;
177 _inp.focus(); _inp.select();
178 return;
179 }
180 if (current) close(); // click anywhere else closes it
181 });
182 document.addEventListener('submit', function(e){
183 var f = e.target.closest && e.target.closest('.fedi-remote-form');
184 if (!f) return; e.preventDefault();
185 go(f.querySelector('input').value, f.dataset.uri);
186 });
187 document.addEventListener('keydown', function(e){ if (e.key === 'Escape') close(); });
188 window.addEventListener('scroll', close, true);
189 })();
190 </script>
191
192
193 <%# ── Related posts (3-card grid) ─────────────────────────────
194 Always shown if at least one related post exists. Selection logic
195 lives server-side: same-tag posts ranked by overlap, falling back
196 to most-recent if there's no tag overlap. %>
197 <% if (relatedPosts && relatedPosts.length > 0) { %>
198 <section class="post-related" aria-labelledby="related-heading">
199 <h2 class="post-related-heading" id="related-heading"><%= t('related.title') %></h2>
200 <ul class="post-related-grid">
201 <% relatedPosts.forEach(function(rp) { %>
202 <li class="post-related-card">
203 <a href="<%= rp._urlBase || '' %>/<%= rp.slug %>"<% if (!rp._urlBase) { %>
204 hx-get="/<%= rp.slug %>?partial=1" hx-target="#pcms-main"
205 hx-push-url="/<%= rp.slug %>" hx-indicator="#pcms-loading"<% } %>>
206 <% if (rp.cover_image_url) { %>
207 <span class="post-related-cover<%= rp.nsfw ? ' nsfw-media' : '' %>" aria-hidden="true"><img class="post-related-img" src="<%= rp.cover_image_url %>" alt="" loading="lazy" decoding="async"<% if (rp.cover_video_url) { %> data-ios-mp4="<%= rp.cover_video_url %>"<% } %>><% if (rp.nsfw) { %><span class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= rp.content_warning || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></span><% } %></span>
208 <% } else { %>
209 <span class="post-related-cover post-related-cover--empty<%= rp.nsfw ? ' nsfw-media' : '' %>" aria-hidden="true"><% if (rp.nsfw) { %><span class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= rp.content_warning || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></span><% } %></span>
210 <% } %>
211 <span class="post-related-meta">
212 <span class="post-related-date"><%= formatDate(rp.published_at) %></span>
213 <span class="post-related-title"><%= rp.title %></span>
214 </span>
215 </a>
216 </li>
217 <% }); %>
218 </ul>
219 </section>
220 <% } %>
221
222</article>
223<style>
224.post-page { max-width: 720px; margin: 0.5rem auto 2rem; padding: 0 1rem; }
225.post-cover { margin: 0 0 2rem; border-radius: 8px; overflow: hidden; }
226.post-cover img, .post-cover video { width: 100%; height: auto; display: block; }
227.post-header { margin-bottom: 2rem; }
228.post-title { font-family: var(--font-display, serif); font-size: 2.5rem; line-height: 1.1; margin: 0 0 1rem; }
229@media (max-width: 600px) { .post-title { font-size: 1.85rem; } }
230.post-meta { font-size: 0.9rem; color: var(--ink-muted); }
231.author { font-weight: 500; color: var(--ink-soft); text-decoration: none; }
232.author:hover { color: var(--accent); }
233.post-content { font-family: var(--font-body, serif); font-size: 1.1rem; line-height: 1.7; color: var(--ink); }
234.post-content p { margin: 1.2em 0; }
235/* Poll (a hosted AS2 Question) — display-only; voting happens from the fediverse. */
236.poll { margin: 1.75rem 0; display: flex; flex-direction: column; gap: .5rem; }
237.poll-opt { position: relative; display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border: 1px solid var(--line, rgba(128,128,128,.25)); border-radius: 8px; overflow: hidden; font-size: .98rem; }
238.poll-bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 18%, transparent); z-index: 0; transition: width .3s ease; }
239.poll-opt.is-lead .poll-bar { background: color-mix(in srgb, var(--accent) 30%, transparent); }
240.poll-name { position: relative; z-index: 1; flex: 1; color: var(--ink); }
241.poll-opt.is-lead .poll-name { font-weight: 600; }
242.poll-pct { position: relative; z-index: 1; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
243.poll-meta { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .85rem; color: var(--ink-muted); }
244.poll-note { font-size: .8rem; color: var(--ink-muted); margin: .1rem 0 0; }
245.like-btn {
246 display: inline-flex; align-items: center; gap: 0.45rem;
247 padding: 0.4rem 0.85rem; border: 1px solid var(--rule); border-radius: 999px;
248 background: var(--paper-2); color: var(--ink); font: inherit; font-size: 0.95rem;
249 cursor: pointer; text-decoration: none; transition: border-color 120ms, color 120ms, background 120ms;
250}
251.like-btn:hover { border-color: var(--accent); }
252.like-btn .like-heart { font-size: 1.1rem; line-height: 1; }
253.like-btn.is-liked { border-color: var(--accent); color: var(--accent); }
254.like-btn.is-liked .like-heart { color: var(--accent); }
255.like-btn .like-count { font-variant-numeric: tabular-nums; }
256.post-content h2 { font-family: var(--font-display, serif); font-size: 1.6rem; margin: 2rem 0 1rem; }
257.post-content h3 { font-family: var(--font-display, serif); font-size: 1.3rem; margin: 1.5rem 0 0.75rem; }
258.post-content a { color: var(--accent); }
259.post-content code { background: var(--paper-2); padding: 0.1em 0.4em; border-radius: 3px; font-family: var(--font-mono, monospace); font-size: 0.9em; }
260.post-content pre { background: var(--paper-2); padding: 1rem; border-radius: 6px; overflow-x: auto; }
261.post-content blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; margin: 1.5rem 0; color: var(--ink-soft); font-style: italic; }
262.post-content img { max-width: 100%; height: auto; border-radius: 6px; }
263.post-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 2rem 0; }
264.tag { background: var(--paper-2); color: var(--ink-soft); padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.85rem; text-decoration: none; transition: background 120ms, color 120ms; }
265.tag:hover { background: var(--accent); color: white; }
266.post-actions { display: flex; gap: 0.5rem; margin: 2rem 0; padding: 1rem; background: var(--paper-2); border-radius: 6px; flex-wrap: wrap; }
267
268/* ============================================================
269 Comments
270 ============================================================ */
271.post-comments {
272 margin-top: 3rem;
273 padding-top: 2rem;
274 border-top: 1px solid var(--rule);
275}
276.comments-heading {
277 font-family: var(--font-display, serif);
278 font-size: 1.5rem;
279 margin: 0 0 1.5rem;
280}
281.comments-empty { color: var(--ink-muted, var(--ink-soft)); margin: 0 0 1.5rem; }
282.comments-pending-flash {
283 background: rgba(40, 160, 90, 0.15);
284 color: #2a9d5e;
285 border: 1px solid rgba(40, 160, 90, 0.3);
286 padding: 0.75rem 1rem;
287 border-radius: 6px;
288 margin-bottom: 1rem;
289 font-size: 0.9rem;
290}
291.comments-empty a { color: var(--accent); }
292
293.comments-list, .comment-replies {
294 list-style: none;
295 padding: 0;
296 margin: 0 0 2rem;
297}
298
299.comment {
300 display: flex;
301 gap: 0.85rem;
302 padding: 1rem 0;
303 border-top: 1px solid var(--rule);
304}
305.comments-list > .comment:first-child { border-top: 0; padding-top: 0; }
306
307.comment-avatar {
308 flex-shrink: 0;
309 width: 40px;
310 height: 40px;
311 border-radius: 50%;
312 background: var(--paper-2);
313 border: 1px solid var(--rule);
314 overflow: hidden;
315 display: inline-flex;
316 align-items: center;
317 justify-content: center;
318}
319.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
320.comment-avatar span {
321 font-family: var(--font-display, serif);
322 font-weight: 700;
323 color: var(--accent);
324}
325
326.comment-body { flex: 1; min-width: 0; }
327.comment-meta {
328 display: flex;
329 gap: 0.5rem;
330 align-items: baseline;
331 flex-wrap: wrap;
332 row-gap: 0.1rem;
333 font-size: 0.85rem;
334 margin-bottom: 0.3rem;
335}
336.comment-author { color: var(--ink); font-weight: 600; text-decoration: none; }
337.comment-author:hover { color: var(--accent); }
338.comment-time { color: var(--ink-muted, var(--ink-soft)); }
339.comment-meta .fedi-handle { overflow-wrap: anywhere; }
340@media (max-width: 560px) {
341 .comment-meta .comment-time { flex-basis: 100%; font-size: 0.78rem; color: var(--ink-faint, var(--ink-muted)); }
342}
343.comment-content {
344 white-space: pre-wrap;
345 word-wrap: break-word;
346 color: var(--ink);
347 line-height: 1.5;
348 font-size: 0.95rem;
349}
350
351.comment-actions {
352 display: flex;
353 gap: 0.5rem;
354 margin-top: 0.4rem;
355 flex-wrap: wrap;
356 align-items: center;
357}
358.fedi-owner-react { display: inline; }
359.fedi-owner-reply { display: inline-block; }
360.fedi-owner-reply[open] { flex-basis: 100%; }
361.comment-reply-btn, .comment-delete-btn {
362 background: none;
363 border: 0;
364 color: var(--ink-muted, var(--ink-soft));
365 font-size: 0.8rem;
366 cursor: pointer;
367 padding: 0.2rem 0;
368 font-family: inherit;
369 text-transform: uppercase;
370 letter-spacing: 0.04em;
371}
372.comment-reply-btn:hover { color: var(--accent); }
373.comment-delete-btn:hover { color: #c33; }
374
375/* Owner comment-action icons — same visual language as the News feed, compact (30px). */
376.fedi-cact { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; padding: 0; box-sizing: border-box;
377 display: inline-flex; align-items: center; justify-content: center; list-style: none;
378 border: 1px solid color-mix(in srgb, var(--ink, #000) 14%, transparent);
379 background: color-mix(in srgb, var(--ink, #000) 3%, transparent);
380 color: var(--ink-soft, #888); cursor: pointer; -webkit-tap-highlight-color: transparent;
381 transition: background .12s, border-color .12s, transform .1s; }
382.fedi-cact::-webkit-details-marker { display: none; }
383.fedi-cact svg { width: 15px; height: 15px; display: block; }
384.fedi-cact:active { transform: scale(.9); }
385.fedi-cact-like svg { color: #e8b04b; }
386.fedi-cact-like:hover { background: color-mix(in srgb, #e8b04b 15%, transparent); border-color: color-mix(in srgb, #e8b04b 50%, transparent); }
387.fedi-cact-like.is-on { background: color-mix(in srgb, #e8b04b 18%, transparent); border-color: color-mix(in srgb, #e8b04b 60%, transparent); }
388.fedi-cact-boost svg { color: #2fa85a; }
389.fedi-cact-boost:hover { background: color-mix(in srgb, #2fa85a 15%, transparent); border-color: color-mix(in srgb, #2fa85a 50%, transparent); }
390.fedi-cact-boost.is-on { background: color-mix(in srgb, #2fa85a 18%, transparent); border-color: color-mix(in srgb, #2fa85a 60%, transparent); }
391.fedi-cact-reply svg { color: var(--accent, #06c); }
392.fedi-cact-reply:hover { background: color-mix(in srgb, var(--accent, #888) 14%, transparent); border-color: color-mix(in srgb, var(--accent, #888) 50%, transparent); }
393
394.comment-replies {
395 margin-top: 1rem;
396 margin-left: 0;
397 border-left: 2px solid var(--rule);
398 padding-left: 1rem;
399}
400.comment-reply { padding: 0.75rem 0; }
401.comment-replies > .comment-reply:first-child { border-top: 0; padding-top: 0; }
402.comment-reply .comment-avatar { width: 32px; height: 32px; }
403.comment-reply .comment-avatar span { font-size: 0.85rem; }
404
405.comment-form, .comment-reply-form {
406 display: flex;
407 flex-direction: column;
408 gap: 0.6rem;
409 background: var(--paper-2);
410 border: 1px solid var(--rule);
411 border-radius: 8px;
412 padding: 1rem;
413 margin-top: 1rem;
414}
415.comment-form-label { display: flex; flex-direction: column; gap: 0.4rem; }
416.comment-form-label > span { font-size: 0.85rem; color: var(--ink-muted, var(--ink-soft)); }
417.comment-form textarea, .comment-reply-form textarea {
418 width: 100%;
419 resize: vertical;
420 min-height: 70px;
421 max-height: 200px;
422 padding: 0.65rem 0.85rem;
423 border: 1px solid var(--rule);
424 border-radius: 5px;
425 background: var(--paper);
426 color: var(--ink);
427 font-family: inherit;
428 font-size: 0.95rem;
429 line-height: 1.4;
430 box-sizing: border-box;
431}
432.comment-form button { align-self: flex-start; }
433.comment-reply-form-actions { display: flex; gap: 0.5rem; }
434/* Show the reply form only AFTER clicking REPLY. The display:flex above would
435 otherwise override the [hidden] attribute → form was always open. */
436.comment-reply-form[hidden] { display: none; }
437.fedi-owner-reply summary { list-style: none; cursor: pointer; }
438.fedi-owner-reply summary::-webkit-details-marker { display: none; }
439.fedi-owner-reply[open] summary { margin-bottom: .45rem; }
440/* DELETE button is inside a <form>; display:contents makes it a direct flex-sibling
441 of REPLY → pixel-perfect alignment + equal gap. */
442.comment-actions form { display: contents; }
443
444.comments-login-cta { margin-top: 1.5rem; text-align: center; }
445
446/* ─── Related posts (3-card grid above pinned-nav) ─────────────── */
447.post-related {
448 margin: 3rem auto 1.5rem;
449 /* Break out of the 720px article column so the cards have room to breathe.
450 Cap at 1100 to match other wide content. */
451 max-width: 1100px;
452 padding: 0 1rem;
453}
454.post-related-heading {
455 font-family: var(--font-ui, system-ui), sans-serif;
456 font-size: 0.75rem;
457 font-weight: 600;
458 text-transform: uppercase;
459 letter-spacing: 0.15em;
460 color: var(--ink-muted, var(--ink-soft));
461 margin: 0 0 1rem;
462}
463.post-related-grid {
464 list-style: none;
465 padding: 0; margin: 0;
466 display: grid;
467 grid-template-columns: repeat(3, minmax(0, 1fr));
468 gap: 1rem;
469}
470@media (max-width: 880px) { .post-related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
471@media (max-width: 540px) { .post-related-grid { grid-template-columns: 1fr; } }
472
473.post-related-card {
474 background: var(--paper);
475 border: 1px solid var(--rule);
476 border-radius: 10px;
477 overflow: hidden;
478 transition: border-color 150ms, transform 150ms;
479}
480.post-related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
481.post-related-card a {
482 display: block;
483 color: inherit;
484 text-decoration: none;
485}
486.post-related-cover {
487 display: block;
488 position: relative;
489 overflow: hidden;
490 aspect-ratio: 16 / 10;
491 background: var(--paper-2) center/cover no-repeat;
492}
493.post-related-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
494.post-related-cover--empty {
495 background-image: linear-gradient(135deg,
496 color-mix(in srgb, var(--accent) 12%, var(--paper-2)),
497 var(--paper-2));
498}
499.post-related-meta {
500 display: flex; flex-direction: column; gap: 0.4rem;
501 padding: 0.85rem 1rem 1.1rem;
502}
503.post-related-date {
504 font-size: 0.78rem;
505 color: var(--ink-muted, var(--ink-soft));
506 font-variant-numeric: tabular-nums;
507}
508.post-related-title {
509 font-family: var(--font-display, serif);
510 font-size: 1.1rem;
511 font-weight: 600;
512 color: var(--ink);
513 line-height: 1.25;
514}
515
516/* ─── Pinned navigation cards (v9 style) ───────────────────────── */
517.post-pinned-nav {
518 display: grid;
519 grid-template-columns: 1fr 1fr;
520 gap: 1rem;
521 margin: 1.5rem auto 2rem;
522 max-width: 1100px;
523 padding: 0 1rem;
524}
525@media (max-width: 600px) {
526 .post-pinned-nav { grid-template-columns: 1fr; }
527}
528
529.post-pinned-card {
530 display: flex; align-items: center; gap: 1rem;
531 padding: 1rem 1.25rem;
532 border: 1.5px solid color-mix(in srgb, var(--accent) 50%, transparent);
533 background: color-mix(in srgb, var(--accent) 6%, var(--paper));
534 border-radius: 10px;
535 text-decoration: none;
536 color: var(--ink);
537 transition: border-color 150ms, background 150ms, transform 150ms;
538 min-height: 88px;
539}
540.post-pinned-card:hover {
541 border-color: var(--accent);
542 background: color-mix(in srgb, var(--accent) 11%, var(--paper));
543 transform: translateY(-2px);
544}
545.post-pinned-arrow {
546 font-size: 1.6rem;
547 color: var(--accent);
548 flex-shrink: 0;
549 line-height: 1;
550}
551.post-pinned-card--next {
552 /* "Volgende" card aligns text to the right with the arrow on the right
553 side, mirroring v9 — the arrow is on the OPPOSITE end from the body. */
554 flex-direction: row-reverse;
555 text-align: right;
556}
557.post-pinned-body {
558 display: flex; flex-direction: column; gap: 0.25rem;
559 flex: 1; min-width: 0;
560}
561.post-pinned-label {
562 font-family: var(--font-ui, system-ui), sans-serif;
563 font-size: 0.7rem; font-weight: 600;
564 text-transform: uppercase;
565 letter-spacing: 0.1em;
566 color: var(--accent);
567}
568.post-pinned-title {
569 font-family: var(--font-display, serif);
570 font-size: 1.05rem; font-weight: 600;
571 color: var(--ink);
572 line-height: 1.25;
573 overflow: hidden;
574 text-overflow: ellipsis;
575 display: -webkit-box;
576 -webkit-line-clamp: 2;
577 -webkit-box-orient: vertical;
578}
579.post-pinned-cta {
580 font-size: 0.78rem;
581 color: var(--accent);
582 font-weight: 500;
583}
584
585/* Edge-of-stack indicator: dashed border, muted styling. */
586.post-pinned-card--edge {
587 flex-direction: column;
588 align-items: flex-start;
589 justify-content: center;
590 gap: 0.35rem;
591 border-style: dashed;
592 background: transparent;
593 color: var(--ink-muted, var(--ink-soft));
594 cursor: default;
595}
596.post-pinned-card--edge:hover {
597 /* Edge cards aren't clickable — undo the lift effect. */
598 transform: none;
599 border-color: color-mix(in srgb, var(--accent) 50%, transparent);
600 background: transparent;
601}
602.post-pinned-edge-label {
603 font-family: var(--font-ui, system-ui), sans-serif;
604 font-size: 0.72rem;
605 font-weight: 600;
606 text-transform: uppercase;
607 letter-spacing: 0.15em;
608 color: var(--accent);
609}
610.post-pinned-edge-title {
611 font-family: var(--font-display, serif);
612 font-size: 1.05rem;
613 font-weight: 600;
614 color: var(--ink);
615}
616</style>
Note: See TracBrowser for help on using the repository browser.