source: Klonkt/src/views/partials/topnav.ejs@ 24cdcc6

main
Last change on this file since 24cdcc6 was 3af8fa3, checked in by Robin Genis <roboburr@…>, 3 months ago

i18n: search button aria-label/title via t('nav.search') instead of hardcoded "Zoeken"

Topnav + bottom-tab search button always showed NL ("Zoeken") as aria-label/tooltip,
even on an EN/DE site. Now translated.

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

  • Property mode set to 100644
File size: 29.7 KB
Line 
1<%
2// Top nav — RESPONSIVE.
3//
4// Mobile (<768px):
5// - Brand centered, small theme-toggle right.
6// - All other actions live in the bottom-tab nav.
7// - Sticky top, blur background, safe-area-top respected.
8//
9// Desktop (≥768px):
10// - Full v9 masthead: brand left, action row right
11// (Archief / Search / Install / Theme / Prutter / User-menu).
12// - bottom-tab is hidden via CSS, so all nav must live here.
13
14const _siteUrlBase = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
15const _isAdmin = typeof bodyClass !== 'undefined' && bodyClass.indexOf('on-admin') >= 0;
16const _hasSearch = !site || site.show_search === undefined || site.show_search;
17const _hasPrutter = user && site && site.enable_prutter && (typeof tenancy !== 'undefined' && tenancy === 'hub') && (typeof premiumUnlocked === 'undefined' || premiumUnlocked);
18const _canPost = user && (typeof canMutate === 'undefined' || canMutate)
19 && permissions && permissions.canCreatePost && permissions.canCreatePost(user, site);
20%>
21
22<header class="masthead">
23 <div class="container masthead-inner">
24
25 <!-- Brand block (always visible) -->
26 <div class="masthead-brand">
27 <% if (_isAdmin) { %>
28 <a href="<%= _siteUrlBase %>/" class="nav-link nav-link-admin"><%= t('nav.back_to_site') %></a>
29 <% } else if (typeof tenancy !== 'undefined' && tenancy === 'hub') { %>
30 <%# Hub: de brand gaat naar de hub-home via HTMX. De chrome wordt in hub-modus
31 altijd gerenderd en via body.on-hub (CSS) verborgen op de landing, dus htmx
32 kan schakelen zonder full-reload → de audioplayer blijft leven. %>
33 <a class="nav-hub-home" href="/" aria-label="Home" title="Home"
34 hx-get="/?partial=1" hx-target="#pcms-main" hx-swap="innerHTML" hx-push-url="/" hx-indicator="#pcms-loading">
35 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
36 </a>
37 <% } else if (site) { %>
38 <a class="site-title" href="<%= _siteUrlBase %>/"
39 hx-get="<%= _siteUrlBase %>/?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
40 hx-push-url="<%= _siteUrlBase %>/" hx-indicator="#pcms-loading"><%= site.title %></a>
41 <% } else { %>
42 <a class="site-title" href="/">Klonkt</a>
43 <% } %>
44 </div>
45
46 <!-- Mobile: theme toggle ONLY for logged-out users.
47 Logged-in users get the toggle inside the profile sheet
48 (bottom-tab → Profiel → Thema). All other actions in bottom-tab. -->
49 <% if (!user) { %>
50 <div class="top-nav-mobile">
51 <button type="button" class="nav-btn" id="theme-toggle-mobile" aria-label="Thema wisselen" title="Thema wisselen">
52 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
53 </button>
54 </div>
55 <% } %>
56
57 <!-- Desktop-only: full action row -->
58 <nav class="top-nav top-nav-desktop" aria-label="Hoofdnavigatie">
59
60 <% if (!_isAdmin) { %>
61 <a class="nav-link" href="<%= _siteUrlBase %>/archive"
62 hx-get="<%= _siteUrlBase %>/archive?partial=1" hx-target="#pcms-main"
63 hx-swap="innerHTML" hx-push-url="<%= _siteUrlBase %>/archive"
64 hx-indicator="#pcms-loading">
65 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 8v13H3V8"/><rect x="1" y="3" width="22" height="5" rx="1"/><line x1="10" y1="12" x2="14" y2="12"/></svg>
66 <span class="nav-label"><%= t('nav.archive') %></span>
67 </a>
68 <% } %>
69
70 <% if (_hasSearch) { %>
71 <button type="button" class="nav-btn" id="search-toggle" aria-label="<%= t('nav.search') %>" title="<%= t('nav.search') %>">
72 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
73 </button>
74 <% } %>
75
76 <button type="button" class="nav-btn" id="pwa-install-btn" hidden aria-label="App installeren" title="App installeren">
77 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
78 </button>
79
80 <button type="button" class="nav-btn" id="theme-toggle" aria-label="Thema wisselen" title="Thema wisselen">
81 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
82 </button>
83
84 <% if (typeof langs !== 'undefined' && langs && langs.length > 1) {
85 var _curLang = (langs.find(function(l){ return l.active; }) || { code: 'nl' }).code;
86 var _langR = (typeof currentPath !== 'undefined' && currentPath) ? currentPath : '/';
87 %>
88 <details class="lang-menu">
89 <summary class="nav-btn lang-toggle" aria-label="<%= t('nav.language') %>" title="<%= t('nav.language') %>">
90 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>
91 <span class="lang-code"><%= _curLang.toUpperCase() %></span>
92 <svg class="lang-caret" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="6 9 12 15 18 9"/></svg>
93 </summary>
94 <div class="lang-dropdown" role="menu">
95 <% langs.forEach(function(l){ %>
96 <a class="lang-item<%= l.active ? ' is-active' : '' %>" role="menuitem" href="/lang/<%= l.code %>?r=<%= encodeURIComponent(_langR) %>"><span class="lang-item-code"><%= l.code.toUpperCase() %></span><%= l.name %></a>
97 <% }); %>
98 </div>
99 </details>
100 <% } %>
101
102 <% if (_hasPrutter) { %>
103 <a class="nav-btn" href="<%= _siteUrlBase %>/prutter" aria-label="Prutter (DMs)" title="Prutter">
104 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" 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>
105 </a>
106 <% } %>
107
108 <% if (user) { %>
109 <a class="nav-btn nav-notif" href="/notifications" aria-label="<%= t('nav.notifications') %>" title="<%= t('nav.notifications') %>"
110 hx-get="/notifications?partial=1" hx-target="#pcms-main" hx-swap="innerHTML" hx-push-url="/notifications" hx-indicator="#pcms-loading">
111 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>
112 <% if (typeof notifUnread !== 'undefined' && notifUnread > 0) { %><span class="notif-badge"><%= notifUnread > 9 ? '9+' : notifUnread %></span><% } %>
113 </a>
114 <% } %>
115
116 <% if (user) { %>
117 <details class="user-menu">
118 <summary class="nav-btn user-toggle" aria-label="Gebruikersmenu">
119 <% if (user.avatar_url) { %>
120 <img class="user-avatar user-avatar-img" src="<%= user.avatar_url %>" alt="">
121 <% } else { %>
122 <span class="user-avatar"><%= user.username.charAt(0).toUpperCase() %></span>
123 <% } %>
124 </summary>
125 <div class="user-dropdown" role="menu">
126 <div class="user-dropdown-header">
127 <% if (user.avatar_url) { %>
128 <img class="udh-avatar" src="<%= user.avatar_url %>" alt="">
129 <% } else { %>
130 <span class="udh-avatar udh-avatar-fallback"><%= user.username.charAt(0).toUpperCase() %></span>
131 <% } %>
132 <div class="udh-meta">
133 <span class="udh-name"><%= user.username %></span>
134 <% if (user.role === 'god') { %>
135 <span class="udh-role">God</span>
136 <% } else if (user.role === 'admin' || user.role === 'moderator') { %>
137 <span class="udh-role"><%= user.role.charAt(0).toUpperCase() + user.role.slice(1) %></span>
138 <% } %>
139 </div>
140 </div>
141 <div class="user-dropdown-list">
142 <a href="/account" role="menuitem" class="udi"
143 hx-get="/account?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
144 hx-push-url="/account" hx-indicator="#pcms-loading">
145 <svg class="udi-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
146 <span><%= t('nav.account') %></span>
147 </a>
148 <a href="/notifications" role="menuitem" class="udi"
149 hx-get="/notifications?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
150 hx-push-url="/notifications" hx-indicator="#pcms-loading">
151 <svg class="udi-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg>
152 <span><%= t('nav.notifications') %><% if (typeof notifUnread !== 'undefined' && notifUnread > 0) { %> (<%= notifUnread %>)<% } %></span>
153 </a>
154 <a href="/favorieten" role="menuitem" class="udi"
155 hx-get="/favorieten?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
156 hx-push-url="/favorieten" hx-indicator="#pcms-loading">
157 <svg class="udi-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>
158 <span><%= t('nav.favorites') %></span>
159 </a>
160 <% if (typeof canSeeBeheer !== 'undefined' && canSeeBeheer) { %>
161 <a href="/admin" role="menuitem" class="udi"
162 hx-get="/admin?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
163 hx-push-url="/admin" hx-indicator="#pcms-loading">
164 <svg class="udi-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3h7v7H3z"/><path d="M14 3h7v7h-7z"/><path d="M14 14h7v7h-7z"/><path d="M3 14h7v7H3z"/></svg>
165 <span><%= t('nav.admin') %></span>
166 </a>
167 <% } %>
168 <% if (_canPost) { %>
169 <a href="<%= _siteUrlBase %>/posts/new" role="menuitem" class="udi"
170 hx-get="<%= _siteUrlBase %>/posts/new?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
171 hx-push-url="<%= _siteUrlBase %>/posts/new" hx-indicator="#pcms-loading">
172 <svg class="udi-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"/></svg>
173 <span><%= t('nav.new_post') %></span>
174 </a>
175 <% } %>
176 </div>
177 <div class="user-dropdown-divider" aria-hidden="true"></div>
178 <div class="user-dropdown-list">
179 <a href="/auth/logout" role="menuitem" class="udi udi-danger">
180 <svg class="udi-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
181 <span><%= t('nav.logout') %></span>
182 </a>
183 </div>
184 </div>
185 </details>
186 <% } else { %>
187 <a class="nav-link" href="/auth/login"
188 hx-get="/auth/login?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
189 hx-push-url="/auth/login" hx-indicator="#pcms-loading">
190 <span class="nav-label"><%= t('nav.login') %></span>
191 </a>
192 <% } %>
193
194 </nav>
195 </div>
196</header>
197
198<!-- Search overlay (shared by mobile bottom-tab + desktop top-nav) -->
199<div id="search-overlay" class="search-overlay" hidden data-suggest="<%= _siteUrlBase %>/search/suggest" data-action="<%= _siteUrlBase %>/search">
200 <div class="container">
201 <form class="search-overlay-form" method="get" action="<%= _siteUrlBase %>/search">
202 <input type="search" name="q" placeholder="<%= t('search.placeholder') %>" autocomplete="off">
203 <button type="submit" class="nav-btn" aria-label="<%= t('search.button') %>">
204 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
205 </button>
206 <button type="button" class="nav-btn" id="search-close" aria-label="<%= t('imed.cancel') %>">
207 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
208 </button>
209 </form>
210 <div id="search-suggest" class="search-suggest" data-lenis-prevent></div>
211 </div>
212</div>
213
214<script>
215(function() {
216 // EÉN keer bedraden. Deze chrome (topnav) wordt bij htmx-navigatie out-of-band
217 // opnieuw ingevoegd → zonder deze guard zou dit script bij elke navigatie EXTRA
218 // listeners stapelen, waardoor de thema-toggle 2× (of vaker) vuurde = geen netto
219 // wisseling ("toggle werkt niet meer"). Alles hieronder is event-delegatie op
220 // body/document, dus het werkt ook voor knoppen die ná deze run (OOB) verschijnen.
221 if (window.__pcmsChromeWired) return;
222 window.__pcmsChromeWired = true;
223
224 function toggleTheme() {
225 var cur = document.documentElement.getAttribute('data-theme') || 'dark';
226 var next = cur === 'dark' ? 'light' : 'dark';
227 document.documentElement.setAttribute('data-theme', next);
228 try { localStorage.setItem('pcms-theme', next); } catch (e) {}
229 }
230 function overlay() { return document.getElementById('search-overlay'); }
231 function openSearch() { var o = overlay(); if (o) { o.hidden = false; var i = o.querySelector('input'); if (i) i.focus(); } }
232 function closeSearch() { var o = overlay(); if (o) { o.hidden = true; var b = document.getElementById('search-suggest'); if (b) b.innerHTML = ''; } }
233
234 document.body.addEventListener('click', function(e) {
235 if (e.target.closest('#theme-toggle, #theme-toggle-mobile, #theme-toggle-footer')) { toggleTheme(); return; }
236 if (e.target.closest('#search-toggle')) { openSearch(); return; }
237 if (e.target.closest('#search-close')) { closeSearch(); return; }
238 // Open dropdowns (gebruikersmenu + taalkeuze) sluiten bij klik erbuiten.
239 document.querySelectorAll('.user-menu[open], .lang-menu[open]').forEach(function(d) {
240 if (!d.contains(e.target)) d.removeAttribute('open');
241 });
242 });
243
244 document.addEventListener('keydown', function(e) {
245 if (e.key === 'Escape') { var o = overlay(); if (o && !o.hidden) closeSearch(); }
246 });
247
248 // ── Live resultaten tijdens typen ───────────────────────────────
249 var _ST = {
250 posts: '<%= t('search.section_posts') %>', tracks: '<%= t('search.section_tracks') %>',
251 events: '<%= t('search.section_events') %>', pages: '<%= t('search.section_pages') %>',
252 all: '<%= t('search.suggest_all') %>', none: '<%= t('search.suggest_empty') %>'
253 };
254 function esc(s) { return String(s == null ? '' : s).replace(/[&<>"]/g, function(c){ return {'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[c]; }); }
255 function renderSuggest(box, d, q, ov) {
256 var html = '';
257 function grp(title, items, fmt) {
258 if (!items || !items.length) return;
259 html += '<div class="ss-group"><div class="ss-title">' + esc(title) + '</div>' + items.map(fmt).join('') + '</div>';
260 }
261 grp(_ST.posts, d.posts, function(p){ return '<a class="ss-item" href="' + esc(p.url) + '">' + esc(p.title) + '</a>'; });
262 grp(_ST.tracks, d.tracks, function(tk){ var sub = tk.artist ? ' <span class="ss-sub">' + esc(tk.artist) + '</span>' : ''; return tk.url ? '<a class="ss-item" href="' + esc(tk.url) + '">' + esc(tk.title) + sub + '</a>' : '<span class="ss-item ss-noclick">' + esc(tk.title) + sub + '</span>'; });
263 grp(_ST.events, d.events, function(ev){ return '<a class="ss-item" href="' + esc(ev.url) + '">' + esc(ev.where || ev.when) + ' <span class="ss-sub">' + esc(ev.when) + '</span></a>'; });
264 grp(_ST.pages, d.pages, function(pg){ return '<a class="ss-item" href="' + esc(pg.url) + '">' + esc(pg.label) + '</a>'; });
265 var hasAny = (d.posts && d.posts.length) || (d.tracks && d.tracks.length) || (d.events && d.events.length) || (d.pages && d.pages.length);
266 if (!hasAny) { box.innerHTML = '<div class="ss-empty">' + esc(_ST.none) + '</div>'; return; }
267 var action = (ov && ov.getAttribute('data-action')) || '/search';
268 html += '<a class="ss-all" href="' + esc(action) + '?q=' + encodeURIComponent(q) + '">' + esc(_ST.all) + '</a>';
269 box.innerHTML = html;
270 }
271 var _sTimer;
272 document.addEventListener('input', function(e) {
273 var inp = e.target.closest && e.target.closest('#search-overlay input[name="q"]');
274 if (!inp) return;
275 var box = document.getElementById('search-suggest');
276 if (!box) return;
277 var q = inp.value.trim();
278 clearTimeout(_sTimer);
279 if (q.length < 2) { box.innerHTML = ''; return; }
280 _sTimer = setTimeout(function() {
281 var ov = document.getElementById('search-overlay');
282 var url = (ov && ov.getAttribute('data-suggest')) || '/search/suggest';
283 fetch(url + '?q=' + encodeURIComponent(q))
284 .then(function(r){ return r.ok ? r.json() : null; })
285 .then(function(d){ if (d) renderSuggest(box, d, q, ov); })
286 .catch(function(){});
287 }, 200);
288 });
289 // Klik op een suggestie → overlay sluiten (de link/boost doet de navigatie).
290 document.addEventListener('click', function(e) {
291 if (e.target.closest && e.target.closest('#search-suggest a')) { var o = overlay(); if (o) o.hidden = true; }
292 });
293})();
294</script>
295
296<style>
297/* ============================================================
298 TOP-NAV — responsive
299 Mobile: brand centered, small theme btn right, NOTHING else.
300 Desktop (≥768px): full v9 layout — brand left, action row right.
301 ============================================================ */
302
303.masthead-inner {
304 /* Override v9's flex-end → space-between so brand is on the left */
305 justify-content: space-between !important;
306 gap: 1rem;
307}
308.masthead-brand .site-title,
309.masthead-brand .nav-link-admin {
310 display: inline-block;
311 vertical-align: middle;
312}
313
314/* Site title is suppressed everywhere — the profile-header carries the brand
315 on content pages, and admin pages have their own "← Terug naar site" link
316 (a different selector, .nav-link-admin, which stays visible). The masthead
317 becomes a thin utility strip with just theme-toggle / search / etc. */
318.masthead-brand .site-title {
319 display: none;
320}
321
322/* Hub-home brand is WÉL zichtbaar — de thuisknop op artiest-/hub-pagina's. */
323.masthead-brand .nav-hub-home {
324 display: inline-flex; align-items: center; justify-content: center;
325 width: 40px; height: 40px;
326 color: var(--ink); text-decoration: none;
327 border-radius: 8px;
328 transition: color 120ms, background 120ms;
329}
330.masthead-brand .nav-hub-home:hover { color: var(--accent); background: var(--paper-2); }
331.masthead-brand .nav-hub-home svg { width: 22px; height: 22px; }
332
333/* On mobile, hide the entire masthead except for admin pages. The brand
334 appears in the profile-header on content pages, and the bottom-tab
335 provides all navigation. Admin keeps it because the "← Terug naar site"
336 link is the only way back to the public site from /admin/*. */
337@media (max-width: 767px) {
338 body:not(.on-admin) .masthead { display: none; }
339}
340
341/* On mobile, center the brand in the masthead */
342@media (max-width: 767px) {
343 .masthead-inner {
344 justify-content: center !important;
345 position: relative;
346 }
347 .masthead-brand {
348 text-align: center;
349 }
350 /* Lone theme button for logged-out users — minimal, icon-only,
351 no border/background to avoid the iOS sticky-hover look. */
352 .top-nav-mobile {
353 position: absolute;
354 right: 0;
355 top: 50%;
356 transform: translateY(-50%);
357 }
358 .top-nav-mobile .nav-btn {
359 width: 44px;
360 height: 44px;
361 padding: 0;
362 background: transparent !important;
363 border-color: transparent !important;
364 color: var(--ink-soft);
365 display: inline-flex;
366 align-items: center;
367 justify-content: center;
368 }
369 .top-nav-mobile .nav-btn:active {
370 transform: scale(0.92);
371 color: var(--ink);
372 }
373 /* Suppress sticky hover on touch — only show feedback for real hover devices */
374 @media (hover: none) {
375 .top-nav-mobile .nav-btn:hover {
376 background: transparent !important;
377 border-color: transparent !important;
378 color: var(--ink-soft);
379 }
380 }
381 .top-nav-desktop {
382 display: none !important;
383 }
384}
385
386/* On desktop, hide the mobile-only theme button */
387@media (min-width: 768px) {
388 .top-nav-mobile { display: none; }
389}
390
391/* ── Admin "back" link styling (inherited from v9 patterns) ── */
392.nav-link-admin {
393 background: var(--accent);
394 color: #fff !important;
395 padding: .5rem .85rem;
396 border-radius: 6px;
397 text-decoration: none;
398 font-family: var(--font-ui);
399 font-size: .875rem;
400 font-weight: 500;
401}
402.nav-link-admin:hover { opacity: .9; color: #fff !important; }
403
404/* ── Tap-target enforcement for all nav buttons on touch ── */
405@media (hover: none) {
406 .nav-btn, .nav-link {
407 min-height: 44px;
408 min-width: 44px;
409 }
410 .nav-btn:active {
411 transform: scale(0.95);
412 background: var(--paper-2);
413 }
414}
415
416/* ── User dropdown (desktop only — mobile uses bottom-tab → /account) ── */
417.user-menu { position: relative; list-style: none; }
418.user-menu > summary {
419 list-style: none; cursor: pointer;
420 padding: .25rem; border-radius: 6px;
421 display: inline-flex; align-items: center;
422 border: 1px solid transparent;
423 transition: all var(--transition);
424}
425.user-menu > summary::-webkit-details-marker { display: none; }
426.user-menu > summary::marker { content: ''; }
427.user-menu > summary:hover { background: var(--paper-2); border-color: var(--rule); }
428.user-avatar {
429 display: inline-flex; align-items: center; justify-content: center;
430 width: 28px; height: 28px; border-radius: 50%;
431 background: var(--paper-2); /* neutral so transparent avatars blend */
432 color: var(--accent); /* fallback initial color */
433 font-family: var(--font-ui); font-weight: 600; font-size: .8rem;
434 pointer-events: none;
435 overflow: hidden;
436}
437.user-avatar-img {
438 /* When the pill renders as <img> instead of <span>, fill it edge-to-edge. */
439 object-fit: cover;
440}
441.user-dropdown {
442 position: absolute; top: calc(100% + .55rem); right: 0;
443 min-width: 220px;
444 padding: .35rem;
445 /* Frosted glass: transparant + zware blur zodat het frosted effect duidelijk is. */
446 background: color-mix(in srgb, var(--paper) 60%, transparent);
447 backdrop-filter: blur(34px) saturate(190%);
448 -webkit-backdrop-filter: blur(34px) saturate(190%);
449 border: 1px solid var(--rule);
450 border-radius: 12px;
451 box-shadow:
452 0 1px 2px color-mix(in srgb, var(--ink) 8%, transparent),
453 0 8px 24px color-mix(in srgb, var(--ink) 14%, transparent),
454 0 16px 48px color-mix(in srgb, var(--ink) 10%, transparent);
455 z-index: 200;
456 font-family: var(--font-ui);
457 transform-origin: top right;
458}
459/* Open animation — only fires when <details open> matches, so closing the
460 dropdown doesn't replay the entry animation. */
461.user-menu[open] > .user-dropdown {
462 animation: ud-fade-in .14s cubic-bezier(.2, .8, .25, 1);
463}
464@keyframes ud-fade-in {
465 from { opacity: 0; transform: translateY(-6px) scale(.98); }
466 to { opacity: 1; transform: translateY(0) scale(1); }
467}
468
469/* Identity header — small avatar + username/role badge */
470.user-dropdown-header {
471 display: flex; align-items: center; gap: .65rem;
472 padding: .55rem .65rem .65rem;
473 border-bottom: 1px solid color-mix(in srgb, var(--rule) 65%, transparent);
474 margin-bottom: .35rem;
475}
476.udh-avatar {
477 width: 36px; height: 36px; border-radius: 50%;
478 object-fit: cover;
479 background: var(--paper-2);
480 display: inline-flex; align-items: center; justify-content: center;
481 flex-shrink: 0;
482}
483.udh-avatar-fallback {
484 color: var(--accent); font-weight: 700; font-size: .95rem;
485}
486.udh-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
487.udh-name {
488 font-weight: 600; font-size: .92rem; color: var(--ink);
489 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px;
490}
491.udh-role {
492 font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
493 color: var(--accent); opacity: .85; margin-top: .12rem;
494}
495
496/* Item list group */
497.user-dropdown-list { display: flex; flex-direction: column; gap: 1px; }
498.user-dropdown-divider {
499 height: 1px;
500 margin: .35rem .25rem;
501 background: color-mix(in srgb, var(--rule) 60%, transparent);
502}
503
504/* Items — icon + label, rounded inner highlight on hover (macOS feel) */
505.user-dropdown .udi {
506 display: flex; align-items: center; gap: .65rem;
507 padding: .5rem .65rem;
508 color: var(--ink); text-decoration: none;
509 font-size: .88rem; font-weight: 500;
510 border-radius: 7px;
511 transition: background var(--transition), color var(--transition), transform var(--transition);
512}
513.user-dropdown .udi:hover,
514.user-dropdown .udi:focus-visible {
515 background: color-mix(in srgb, var(--accent) 10%, var(--paper-2));
516 color: var(--accent);
517 outline: none;
518}
519.user-dropdown .udi:active { transform: scale(.98); }
520.user-dropdown .udi-icon {
521 width: 16px; height: 16px;
522 opacity: .7;
523 flex-shrink: 0;
524 transition: opacity var(--transition);
525}
526.user-dropdown .udi:hover .udi-icon,
527.user-dropdown .udi:focus-visible .udi-icon { opacity: 1; }
528
529/* Logout: subtle danger tint on hover, never on rest. Uses a fixed red so
530 it always reads as a destructive action even if the user's accent is red. */
531.user-dropdown .udi-danger:hover,
532.user-dropdown .udi-danger:focus-visible {
533 background: color-mix(in srgb, #dc2626 14%, var(--paper-2));
534 color: #dc2626;
535}
536
537/* ── Search overlay ── */
538.search-overlay {
539 position: fixed; top: 0; left: 0; right: 0;
540 background: color-mix(in srgb, var(--paper) 96%, transparent);
541 backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
542 border-bottom: 1px solid var(--rule);
543 padding: 1rem 0; z-index: 200;
544 padding-top: calc(1rem + env(safe-area-inset-top, 0));
545 box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 8%, transparent);
546}
547.search-overlay-form { display: flex; gap: .5rem; align-items: center; }
548.search-overlay-form input {
549 flex: 1; padding: .85rem 1rem;
550 min-height: 44px;
551 border: 1px solid var(--rule); border-radius: 8px;
552 font-family: var(--font-ui); font-size: 1rem;
553 background: var(--paper); color: var(--ink);
554}
555.search-overlay-form input:focus {
556 outline: 2px solid var(--accent); outline-offset: 0;
557}
558.search-overlay-form .nav-btn {
559 width: 44px; height: 44px;
560 display: inline-flex; align-items: center; justify-content: center;
561}
562/* Live-resultaten dropdown */
563.search-suggest { margin-top: .6rem; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: .25rem; }
564.search-suggest:empty { display: none; }
565.ss-group { padding: .25rem 0; }
566.ss-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft, var(--ink-muted)); padding: .35rem .25rem .2rem; }
567.ss-item { display: block; padding: .55rem .6rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .95rem; }
568.ss-item:hover { background: var(--paper-2); color: var(--accent); }
569.ss-item.ss-noclick { opacity: .7; cursor: default; }
570.ss-sub { color: var(--ink-soft, var(--ink-muted)); font-size: .85em; }
571.ss-empty { padding: .8rem .6rem; color: var(--ink-soft, var(--ink-muted)); font-size: .9rem; }
572.ss-all { display: block; margin-top: .35rem; padding: .55rem .6rem; border-top: 1px solid var(--rule); color: var(--accent); font-weight: 600; text-decoration: none; font-size: .9rem; }
573.ss-all:hover { text-decoration: underline; }
574/* Meldingen-bel + ongelezen-badge */
575.nav-notif { position: relative; }
576.notif-badge {
577 position: absolute; top: 1px; right: 1px;
578 min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
579 display: inline-flex; align-items: center; justify-content: center;
580 background: #e0245e; color: #fff; font-size: 10px; font-weight: 700;
581 border-radius: 999px; line-height: 1; pointer-events: none;
582}
583</style>
Note: See TracBrowser for help on using the repository browser.