source: Klonkt/src/views/pages/admin-site-edit.ejs@ 99234c3

main
Last change on this file since 99234c3 was 34076d7, checked in by Robin Genis <roboburr@…>, 3 months ago

feat(appearance): live theme preview in site settings

Selecting an accent, theme or palette now re-themes the settings page instantly
(updates data-palette/data-theme + the --accent style block, mirroring the shell)
so you see it before saving; reverts on reload, persists on save. Also fixes a
stale 'sage' default in the palette picker -> klonkt.

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

  • Property mode set to 100644
File size: 25.7 KB
Line 
1<div class="container admin-site-edit-page">
2 <p><a href="/admin" class="btn">&larr; <%= t('asite.back_admin') %></a></p>
3 <h1><%= isNew ? t('asite.title_new') : t('asite.title_edit') + ': ' + site.title %></h1>
4
5 <% if (typeof success !== 'undefined' && success) { %><div class="audio-flash audio-flash--ok"><%= success %></div><% } %>
6 <% if (error) { %><div class="audio-flash audio-flash--err"><%= error %></div><% } %>
7
8 <form method="post" action="<%= isNew ? '/admin/sites/create' : '/admin/sites/' + site.slug + '/save' %>" class="site-form">
9
10 <fieldset>
11 <legend><%= t('asite.identity') %></legend>
12 <label>
13 <span><%= t('asite.slug') %> <% if (!isNew) { %><em><%= t('asite.slug_fixed') %></em><% } %></span>
14 <span class="slug-url">
15 <span class="slug-url-host" id="slug-host"
16 data-prefix="<%= (typeof tenancy !== 'undefined' && tenancy === 'hub') ? '/user/' : '/' %>">website.com/</span><input
17 type="text" name="slug" id="slug-input" class="slug-url-input" value="<%= site.slug %>" required <% if (!isNew) { %>readonly<% } %>
18 pattern="[a-z0-9_-]{2,40}" placeholder="<%= t('asite.slug_placeholder') %>"
19 autocapitalize="none" autocorrect="off" spellcheck="false">
20 </span>
21 </label>
22 <label>
23 <span><%= t('asite.field_title') %> <small class="form-hint-inline"><%= t('asite.field_title_hint') %></small></span>
24 <input type="text" name="title" value="<%= site.title || '' %>" required maxlength="200">
25 </label>
26 <%# Assign (or reassign) owner — ONLY god AND only in hub mode. In hub this
27 gives each user their own self-managed Klonkt. In solo (one site,
28 one owner) this is pointless/confusing, so it's hidden. %>
29 <% if (user && user.role === 'god' && (typeof tenancy !== 'undefined' && tenancy === 'hub')) { %>
30 <label>
31 <span><%= t('asite.owner') %> <small class="form-hint-inline"><%= t('asite.owner_hint') %></small></span>
32 <% var _godSuffix = t('asite.owner_god_suffix'); %>
33 <select name="owner_id">
34 <% (typeof users !== 'undefined' ? users : []).forEach(function(u){ %>
35 <option value="<%= u.id %>" <%= (site.owner_id === u.id) ? 'selected' : '' %>><%= u.username %><%= u.role === 'god' ? _godSuffix : '' %></option>
36 <% }); %>
37 </select>
38 </label>
39 <% } %>
40 <label>
41 <span><%= t('asite.tagline') %> <small class="form-hint-inline"><%= t('asite.tagline_hint') %></small></span>
42 <input type="text" name="tagline" value="<%= site.tagline || '' %>" maxlength="200">
43 </label>
44 <label>
45 <span><%= t('asite.bio') %> <small class="form-hint-inline"><%= t('asite.bio_hint') %></small></span>
46 <textarea name="description" rows="3" maxlength="500"><%= site.description || '' %></textarea>
47 </label>
48 <label>
49 <span><%= t('asite.profile_photo') %></span>
50 <div class="photo-picker" id="photo-picker">
51 <div class="photo-thumb" id="photo-thumb" <%= site.profile_photo ? '' : 'data-empty' %>>
52 <img id="photo-preview" src="<%= site.profile_photo || '' %>" alt="" <%= site.profile_photo ? '' : 'hidden' %>>
53 <span class="photo-empty" aria-hidden="true">
54 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><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>
55 </span>
56 </div>
57 <div class="photo-controls">
58 <input type="text" name="profile_photo" id="photo-url" value="<%= site.profile_photo || '' %>" placeholder="<%= t('asite.photo_url_placeholder') %>">
59 <div class="photo-actions">
60 <button type="button" class="btn" id="photo-upload-trigger"><%= t('asite.photo_upload') %></button>
61 <button type="button" class="btn" id="photo-clear" <%= site.profile_photo ? '' : 'hidden' %>><%= t('asite.photo_clear') %></button>
62 <small id="photo-status" class="form-hint photo-status"></small>
63 </div>
64 <input type="file" id="photo-upload-field" accept="image/jpeg,image/png,image/webp,image/gif" hidden>
65 </div>
66 </div>
67 </label>
68 <label>
69 <span><%= t('asite.language') %></span>
70 <input type="text" name="language" value="<%= site.language || 'nl' %>" maxlength="8">
71 </label>
72 <label class="cb">
73 <input type="checkbox" name="profile_enabled" value="1" <%= site.profile_enabled ? 'checked' : '' %>>
74 <span><%= t('asite.profile_enabled') %></span>
75 </label>
76 </fieldset>
77
78 <fieldset>
79 <legend><%= t('asite.appearance') %></legend>
80
81 <%# ── Curated accent picker ───────────────────────────────────────
82 Was a free-form <input type="color">; now a fixed set of 8 hand-
83 picked colors that work in both light and dark themes. The hex is
84 still what's stored in the DB — we just constrain WHICH hex. %>
85 <fieldset class="accent-grid">
86 <legend><%= t('asite.accent_color') %></legend>
87 <% const _curAccent = (site.accent || '#c2410c').toLowerCase(); %>
88 <% accents.forEach(function(a) { %>
89 <label class="accent-swatch" title="<%= a.name %>">
90 <input type="radio" name="accent" value="<%= a.color %>" <%= a.color.toLowerCase() === _curAccent ? 'checked' : '' %>>
91 <span class="accent-dot" style="background: <%= a.color %>;" aria-hidden="true"></span>
92 <span class="accent-swatch-name"><%= a.name %></span>
93 </label>
94 <% }); %>
95 </fieldset>
96
97 <%# ── Default theme for new visitors ───────────────────────────
98 'auto' (empty value) lets the browser/OS decide via prefers-color-scheme.
99 'light' / 'dark' force the site default for visitors who haven't picked
100 their own preference yet. Logged-in users with users.theme set, and
101 visitors with a localStorage override, still win over this default. %>
102 <fieldset class="theme-default">
103 <legend><%= t('asite.theme_default') %></legend>
104 <% const td = site.theme_override || ''; %>
105 <label class="cb">
106 <input type="radio" name="theme_override" value="" <%= td === '' ? 'checked' : '' %>>
107 <span><%= t('asite.theme_auto') %></span>
108 </label>
109 <label class="cb">
110 <input type="radio" name="theme_override" value="light" <%= td === 'light' ? 'checked' : '' %>>
111 <span><%= t('asite.theme_light') %></span>
112 </label>
113 <label class="cb">
114 <input type="radio" name="theme_override" value="dark" <%= td === 'dark' ? 'checked' : '' %>>
115 <span><%= t('asite.theme_dark') %></span>
116 </label>
117 </fieldset>
118
119 <fieldset class="palette-grid">
120 <legend><%= t('asite.palette') %></legend>
121 <% palettes.forEach(function(p) { %>
122 <label class="palette-swatch">
123 <input type="radio" name="palette" value="<%= p.key %>" <%= (site.palette || 'klonkt') === p.key ? 'checked' : '' %>>
124 <span class="palette-preview" aria-hidden="true">
125 <span class="pp-half pp-light" style="background: <%= p.light.paper %>; color: <%= p.light.ink %>;">
126 <span class="pp-letter">Aa</span>
127 <span class="pp-accent" style="background: <%= p.light.accent %>;"></span>
128 </span>
129 <span class="pp-half pp-dark" style="background: <%= p.dark.paper %>; color: <%= p.dark.ink %>;">
130 <span class="pp-letter">Aa</span>
131 <span class="pp-accent" style="background: <%= p.dark.accent %>;"></span>
132 </span>
133 </span>
134 <span class="palette-swatch-name"><%= p.name %></span>
135 </label>
136 <% }); %>
137 </fieldset>
138 </fieldset>
139
140 <%# Live preview: selecting an accent / theme / palette re-themes this page
141 instantly (reverts on reload; persists on save). %>
142 <script>
143 (function(){
144 if (window.__themePreviewWired) return; window.__themePreviewWired = true;
145 var html = document.documentElement;
146 function applyAccent(hex){
147 if(!/^#[0-9a-fA-F]{6}$/.test(hex)) return;
148 var sa = document.getElementById('pcms-site-accent');
149 if(!sa){ sa = document.createElement('style'); sa.id = 'pcms-site-accent'; document.head.appendChild(sa); }
150 sa.textContent = ':root,[data-palette]{--accent:'+hex+';--accent-soft:color-mix(in srgb,'+hex+' 80%,white);--accent-tint:color-mix(in srgb,'+hex+' 12%,transparent);}';
151 }
152 document.addEventListener('change', function(e){
153 var t = e.target; if(!t || !t.name) return;
154 if(t.name === 'palette'){ html.setAttribute('data-palette', t.value); }
155 else if(t.name === 'accent'){ applyAccent(t.value); }
156 else if(t.name === 'theme_override'){
157 if(t.value === 'light' || t.value === 'dark'){ html.setAttribute('data-theme', t.value); }
158 else { var dk = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; html.setAttribute('data-theme', dk ? 'dark' : 'light'); }
159 }
160 });
161 })();
162 </script>
163
164 <fieldset>
165 <legend><%= t('asite.behavior') %></legend>
166 <label class="cb">
167 <input type="checkbox" name="is_public" value="1" <%= site.is_public ? 'checked' : '' %>>
168 <span><%= t('asite.is_public') %></span>
169 </label>
170 <label class="cb">
171 <input type="checkbox" name="robots_index" value="1" <%= site.robots_index ? 'checked' : '' %>>
172 <span><%= t('asite.robots_index') %></span>
173 </label>
174 <% if (typeof audioEnabled === 'undefined' || audioEnabled) { %>
175 <label class="cb">
176 <input type="checkbox" name="enable_audio_player" value="1" <%= site.enable_audio_player ? 'checked' : '' %>>
177 <span><%= t('asite.enable_audio') %></span>
178 </label>
179 <% } %>
180 </fieldset>
181
182 <fieldset class="profile-links-fieldset">
183 <legend><%= t('asite.links') %></legend>
184 <p class="form-hint"><%= t('asite.links_hint') %></p>
185
186 <div id="profile-links-rows">
187 <% (parsedLinks || []).forEach(function(l) { %>
188 <div class="profile-link-row">
189 <select name="profile_link_platform[]">
190 <% platforms.forEach(function(p) { %>
191 <option value="<%= p.key %>" <%= l.platform === p.key ? 'selected' : '' %>><%= p.label %></option>
192 <% }); %>
193 </select>
194 <input type="text" name="profile_link_url[]" value="<%= l.url %>" placeholder="https://…" required>
195 <button type="button" class="btn btn-danger pl-remove">×</button>
196 </div>
197 <% }); %>
198 </div>
199
200 <template id="profile-link-template">
201 <div class="profile-link-row">
202 <select name="profile_link_platform[]">
203 <% platforms.forEach(function(p) { %>
204 <option value="<%= p.key %>"><%= p.label %></option>
205 <% }); %>
206 </select>
207 <input type="text" name="profile_link_url[]" placeholder="https://…" required>
208 <button type="button" class="btn btn-danger pl-remove">×</button>
209 </div>
210 </template>
211
212 <button type="button" id="profile-link-add" class="btn"><%= t('asite.link_add') %></button>
213 </fieldset>
214
215 <fieldset>
216 <legend><%= t('asite.feed_view') %></legend>
217 <label>
218 <span><%= t('asite.feed_default') %></span>
219 <select name="feed_view_default">
220 <option value="timeline" <%= (site.feed_view_default || 'timeline') === 'timeline' ? 'selected' : '' %>><%= t('asite.feed_timeline') %></option>
221 <option value="grid" <%= site.feed_view_default === 'grid' ? 'selected' : '' %>><%= t('asite.feed_grid') %></option>
222 </select>
223 </label>
224 <label class="cb">
225 <input type="checkbox" name="feed_view_switch" value="1" <%= site.feed_view_switch ? 'checked' : '' %>>
226 <span><%= t('asite.feed_switch') %></span>
227 </label>
228 <label class="cb">
229 <input type="checkbox" name="show_search" value="1" <%= site.show_search ? 'checked' : '' %>>
230 <span><%= t('asite.show_search') %></span>
231 </label>
232 <label class="cb">
233 <input type="checkbox" name="show_archive_link" value="1" <%= site.show_archive_link ? 'checked' : '' %>>
234 <span><%= t('asite.show_archive') %></span>
235 </label>
236 </fieldset>
237
238 <fieldset class="seo-pointer">
239 <legend><%= t('asite.seo') %></legend>
240 <p><%= t('asite.seo_pointer') %> <a href="/admin/seo"><%= t('asite.seo_link') %></a>.</p>
241 </fieldset>
242
243 <fieldset>
244 <legend><%= t('asite.custom_legend') %> <em><%= t('asite.optional') %></em></legend>
245 <label>
246 <span><%= t('asite.custom_css') %></span>
247 <textarea name="custom_css" rows="3" placeholder=".foo { color: red; }"><%= site.custom_css || '' %></textarea>
248 </label>
249 <label>
250 <span><%= t('asite.custom_head') %></span>
251 <textarea name="custom_head_html" rows="3" placeholder="<meta name=&quot;...&quot;>"><%= site.custom_head_html || '' %></textarea>
252 </label>
253 <label>
254 <span><%= t('asite.custom_foot') %></span>
255 <textarea name="custom_foot_html" rows="3"><%= site.custom_foot_html || '' %></textarea>
256 </label>
257 </fieldset>
258
259 <button type="submit" class="btn btn-primary"><%= isNew ? t('asite.submit_create') : t('asite.submit_save') %></button>
260 </form>
261</div>
262
263<script>
264(function() {
265 // Slug URL field: show the real host as a dimmed prefix (the slug itself is
266 // coloured via CSS). Hub → host/user/<slug>, otherwise host/<slug>.
267 var sh = document.getElementById('slug-host');
268 if (sh) sh.textContent = location.host + (sh.dataset.prefix || '/');
269})();
270(function() {
271 // Profile-links repeater: add row from <template>, remove on click.
272 var rows = document.getElementById('profile-links-rows');
273 var tpl = document.getElementById('profile-link-template');
274 var add = document.getElementById('profile-link-add');
275 if (!rows || !tpl || !add) return;
276
277 add.addEventListener('click', function() {
278 var clone = tpl.content.cloneNode(true);
279 rows.appendChild(clone);
280 });
281 rows.addEventListener('click', function(e) {
282 if (e.target && e.target.classList.contains('pl-remove')) {
283 var row = e.target.closest('.profile-link-row');
284 if (row) row.remove();
285 }
286 });
287})();
288
289// P63 — Profile photo picker: upload via /admin/sites/upload-photo,
290// then write the returned URL into the visible input. Live thumb preview.
291(function() {
292 var picker = document.getElementById('photo-picker');
293 if (!picker) return;
294 var thumb = document.getElementById('photo-thumb');
295 var preview = document.getElementById('photo-preview');
296 var urlEl = document.getElementById('photo-url');
297 var trigger = document.getElementById('photo-upload-trigger');
298 var clear = document.getElementById('photo-clear');
299 var field = document.getElementById('photo-upload-field');
300 var status = document.getElementById('photo-status');
301
302 function showPreview(url) {
303 if (url) {
304 preview.src = url;
305 preview.hidden = false;
306 thumb.removeAttribute('data-empty');
307 clear.hidden = false;
308 } else {
309 preview.src = '';
310 preview.hidden = true;
311 thumb.setAttribute('data-empty', '');
312 clear.hidden = true;
313 }
314 }
315
316 if (urlEl) {
317 urlEl.addEventListener('input', function() {
318 showPreview(urlEl.value.trim());
319 });
320 }
321
322 if (trigger && field) {
323 trigger.addEventListener('click', function() { field.click(); });
324 field.addEventListener('change', async function() {
325 var file = field.files && field.files[0];
326 if (!file) return;
327 status.classList.remove('is-error');
328 status.textContent = 'Uploaden…';
329 try {
330 var fd = new FormData();
331 fd.append('photo', file);
332 var r = await fetch('/admin/sites/upload-photo', {
333 method: 'POST',
334 body: fd,
335 credentials: 'same-origin',
336 });
337 var j = await r.json();
338 if (!r.ok || !j.ok) throw new Error(j.error || ('Upload mislukt (' + r.status + ')'));
339 urlEl.value = j.url;
340 showPreview(j.url);
341 status.textContent = 'Geüpload ✓';
342 setTimeout(function() { status.textContent = ''; }, 2000);
343 } catch (e) {
344 status.classList.add('is-error');
345 status.textContent = 'Mislukt: ' + e.message;
346 } finally {
347 field.value = '';
348 }
349 });
350 }
351
352 if (clear) {
353 clear.addEventListener('click', function() {
354 urlEl.value = '';
355 showPreview('');
356 status.textContent = '';
357 // Note: doesn't delete the file from disk — saving the form with empty
358 // URL leaves the file orphaned on the server. Acceptable for now.
359 });
360 }
361})();
362</script>
363
364<style>
365.admin-site-edit-page { max-width: 760px; margin: 3rem auto; padding: 0 1rem; }
366.admin-site-edit-page h1 { font-family: var(--font-display, serif); font-size: 1.8rem; margin: 0 0 1.5rem; }
367
368.site-form { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
369/* Mobile: a <fieldset> has a browser-default min-inline-size:min-content and
370 therefore does NOT shrink → the entire form became wider than the screen. min-width:0
371 forces it to shrink; form fields get max-width:100% + border-box so they
372 never overflow their fieldset. */
373.site-form fieldset { min-width: 0; }
374.site-form input, .site-form select, .site-form textarea { min-width: 0; max-width: 100%; box-sizing: border-box; }
375.site-form fieldset {
376 border: 1px solid var(--rule);
377 border-radius: 8px;
378 padding: 1rem 1.25rem;
379 background: var(--paper-2);
380 display: flex;
381 flex-direction: column;
382 gap: 0.75rem;
383}
384.site-form fieldset.palette-grid {
385 display: grid;
386 grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
387 background: var(--paper);
388 margin-top: 0.5rem;
389}
390/* Theme default radios — horizontal, sits between accent + palette */
391.site-form fieldset.theme-default {
392 display: flex; flex-direction: row; flex-wrap: wrap; gap: 1rem;
393 background: var(--paper);
394 margin-top: 0.5rem;
395}
396.site-form fieldset.theme-default label.cb { font-size: 0.9rem; color: var(--ink); }
397.site-form fieldset legend { font-family: var(--font-display, serif); font-size: 1rem; padding: 0 0.4rem; }
398.site-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--ink-muted, var(--ink-soft)); }
399.site-form label.cb { flex-direction: row; align-items: center; gap: 0.5rem; }
400.site-form input[type="text"], .site-form input[type="color"], .site-form textarea {
401 padding: 0.55rem 0.85rem;
402 border: 1px solid var(--rule);
403 border-radius: 5px;
404 background: var(--paper);
405 color: var(--ink);
406 font-family: inherit;
407 font-size: 0.95rem;
408}
409.site-form input[type="color"] { padding: 0.2rem; height: 38px; }
410.site-form textarea { resize: vertical; min-height: 60px; font-family: var(--font-mono, monospace); font-size: 0.85rem; }
411.site-form input[readonly] { opacity: 0.6; cursor: not-allowed; background: var(--paper-2); }
412
413/* Slug as URL field: dimmed host prefix + the slug itself in the accent colour. */
414.slug-url {
415 display: flex; align-items: stretch;
416 border: 1px solid var(--rule); border-radius: 5px;
417 background: var(--paper); overflow: hidden;
418 transition: border-color 120ms;
419}
420.slug-url:focus-within { border-color: var(--accent); }
421.slug-url-host {
422 display: inline-flex; align-items: center;
423 padding-left: 0.85rem;
424 color: var(--ink-muted, var(--ink-soft));
425 white-space: nowrap; user-select: none;
426 font-size: 0.95rem;
427}
428.site-form .slug-url-input {
429 flex: 1 1 auto; min-width: 0;
430 border: none !important; border-radius: 0 !important;
431 background: transparent !important;
432 color: var(--accent) !important; font-weight: 700;
433 padding: 0.55rem 0.85rem 0.55rem 0.1rem;
434}
435.site-form .slug-url-input:focus { outline: none; }
436.site-form .slug-url-input[readonly] {
437 opacity: 1; cursor: default; background: transparent !important;
438}
439
440/* Selects: same look as the inputs, with a custom chevron instead of the bare
441 native arrow. The open option list is still rendered by the browser. */
442.site-form select {
443 appearance: none;
444 -webkit-appearance: none;
445 padding: 0.55rem 2.2rem 0.55rem 0.85rem;
446 border: 1px solid var(--rule);
447 border-radius: 5px;
448 background-color: var(--paper);
449 color: var(--ink);
450 font-family: inherit;
451 font-size: 0.95rem;
452 cursor: pointer;
453 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
454 background-repeat: no-repeat;
455 background-position: right 0.7rem center;
456 transition: border-color 0.15s ease, box-shadow 0.15s ease;
457}
458.site-form select:hover { border-color: var(--ink-soft, #888); }
459.site-form select:focus,
460.site-form input[type="text"]:focus,
461.site-form textarea:focus {
462 outline: none;
463 border-color: var(--accent, #c2410c);
464 box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #c2410c) 22%, transparent);
465}
466
467/* Reuse the palette-swatch styles from account.ejs */
468.palette-swatch {
469 display: flex; flex-direction: column; gap: 0.4rem;
470 padding: 0.5rem;
471 border: 1px solid var(--rule); border-radius: 6px; background: var(--paper);
472 cursor: pointer; font-size: 0.85rem; transition: border-color 120ms;
473}
474.palette-swatch:hover { border-color: var(--accent); }
475.palette-swatch input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
476.palette-swatch:has(input[type="radio"]:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
477.palette-preview {
478 display: grid; grid-template-columns: 1fr 1fr;
479 width: 100%; height: 44px; border-radius: 4px; overflow: hidden;
480 border: 1px solid var(--rule);
481}
482.pp-half {
483 position: relative;
484 display: flex; align-items: center; justify-content: center;
485 font-family: var(--font-display, serif); font-weight: 600; font-size: 1rem;
486}
487.pp-letter { line-height: 1; }
488.pp-accent {
489 position: absolute; bottom: 4px; right: 4px;
490 width: 9px; height: 9px; border-radius: 50%;
491 border: 1px solid rgba(0,0,0,0.12);
492}
493.palette-swatch-name { font-weight: 500; color: var(--ink); text-align: center; }
494
495/* Accent picker: row of small colored swatches */
496.site-form fieldset.accent-grid {
497 display: grid;
498 grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
499 gap: 0.5rem;
500 background: var(--paper);
501 margin-top: 0.5rem;
502}
503.accent-swatch {
504 display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
505 padding: 0.55rem 0.4rem;
506 border: 1px solid var(--rule); border-radius: 6px; background: var(--paper);
507 cursor: pointer; font-size: 0.78rem;
508 transition: border-color 120ms, box-shadow 120ms;
509}
510.accent-swatch:hover { border-color: var(--accent); }
511.accent-swatch input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
512.accent-swatch:has(input[type="radio"]:checked) {
513 border-color: var(--accent);
514 box-shadow: 0 0 0 2px var(--accent);
515}
516.accent-dot {
517 width: 28px; height: 28px; border-radius: 50%;
518 border: 1px solid rgba(0,0,0,0.1);
519 box-shadow: inset 0 -2px 4px rgba(0,0,0,0.12);
520}
521.accent-swatch-name { color: var(--ink); text-align: center; font-weight: 500; }
522
523.audio-flash { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
524.audio-flash--ok { background: rgba(40, 160, 90, 0.15); color: #2a9d5e; border: 1px solid rgba(40, 160, 90, 0.3); }
525.audio-flash--err { background: rgba(200, 60, 60, 0.15); color: #c33; border: 1px solid rgba(200, 60, 60, 0.3); }
526
527.form-hint { font-size: 0.8rem; color: var(--ink-muted, var(--ink-soft)); margin: 0; }
528.form-hint-inline { font-size: 0.78rem; color: var(--ink-muted, var(--ink-soft)); font-weight: 400; margin-left: .25rem; }
529
530/* P63 — Profile photo picker
531 Mobile-first: thumb stacks above input/buttons. ≥520px the thumb floats
532 to the left and the controls fill the remaining width. */
533.photo-picker {
534 display: flex;
535 flex-direction: column;
536 gap: .65rem;
537 align-items: stretch;
538}
539.photo-thumb {
540 position: relative;
541 width: 88px; height: 88px;
542 border-radius: 50%;
543 border: 1px solid var(--rule);
544 background: var(--paper-2);
545 overflow: hidden;
546 flex-shrink: 0;
547 display: flex; align-items: center; justify-content: center;
548}
549.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
550.photo-thumb .photo-empty {
551 display: flex; color: var(--ink-muted, var(--ink-soft)); opacity: .55;
552}
553.photo-thumb .photo-empty svg { width: 36px; height: 36px; }
554.photo-thumb:not([data-empty]) .photo-empty { display: none; }
555.photo-thumb[data-empty] img { display: none; }
556
557.photo-controls {
558 display: flex;
559 flex-direction: column;
560 gap: .5rem;
561 flex: 1;
562 min-width: 0;
563}
564.photo-controls input[type="text"] { width: 100%; }
565.photo-actions {
566 display: flex; align-items: center; flex-wrap: wrap;
567 gap: .4rem;
568}
569.photo-actions .btn { padding: .45rem .75rem; font-size: .85rem; }
570.photo-status { margin-left: .25rem; }
571.photo-status.is-error { color: #c2410c; }
572
573@media (min-width: 520px) {
574 .photo-picker { flex-direction: row; align-items: flex-start; gap: 1rem; }
575 .photo-controls { gap: .55rem; }
576}
577/* Mobile-first: platform selector on its own line (full width), URL input + remove
578 button below. Prevents horizontal overflow on phones (fixed 160px column +
579 non-shrinkable input together ~447px > screen width). */
580.profile-link-row {
581 display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; margin-bottom: 0.5rem;
582}
583.profile-link-row select { padding: 0.45rem 0.6rem; grid-column: 1 / -1; }
584.profile-link-row input { min-width: 0; }
585@media (min-width: 520px) {
586 .profile-link-row { grid-template-columns: 160px 1fr auto; }
587 .profile-link-row select { grid-column: auto; }
588}
589.profile-links-fieldset details > label { margin-top: 0.4rem; }
590</style>
Note: See TracBrowser for help on using the repository browser.