From b70a65d39e17110511b1f2b0bd9d0c2f6e75fe97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asger=20Geel=20Weirs=C3=B8e?= Date: Sun, 14 Jun 2026 19:05:00 +0200 Subject: [PATCH] Dark-mode styling + mobile no-sideways-scroll guards - adapters/bulma.css: dark progress bars (surface track + accent/good fill). - base: body overflow-x:hidden + overflow-wrap, and .media-content min-width:0 so long content wraps instead of widening the page on mobile. --- README.md | 17 ------ adapters/bulma.css | 14 +++++ weirsoe-theme.css | 145 +-------------------------------------------- 3 files changed, 17 insertions(+), 159 deletions(-) diff --git a/README.md b/README.md index 3daa264..c6543bf 100644 --- a/README.md +++ b/README.md @@ -77,23 +77,6 @@ Semantic classes so a site can drop hand-written CSS entirely: | `.prose` | long-form markdown | | `.theme-toggle` + `.sun-and-moon` | the sun⇄moon toggle (wire with `weirsoe-theme.js`) | -### App-shell primitives - -Reusable building blocks for dashboard/admin UIs (used by `weircon.dk`): - -| Class | What | -|---|---| -| `.wt-grid` (`--tight`) | auto-fill responsive card grid | -| `.wt-tile` (`--hover`) + `.wt-tile-head/-ico/-name/-sub/-go` | icon launch card (app launcher) | -| `.wt-stat` + `.wt-stat-n/-label` | big-number stat card | -| `.wt-lead` | muted lead paragraph | -| `.wt-field` + `.wt-field-ico` (wraps `.wt-input`) | search input with leading icon | -| `.wt-flash` (`--error`) | notice / flash banner | -| `.wt-table` | bordered data table | -| `.wt-toolbar` / `.wt-segment` (`button.is-on`) | toolbar + segmented toggle | -| `.wt-select-card` + `-ini/-body/-name/-sub/-chk` | selectable (checkbox) card | -| `.wt-palette` + `-box/-input/-list/-item/-badge/-hint` | ⌘K command palette | - These mirror, 1:1, the chrome of `agw/pw` (asger.weirsøe.dk) — the goal is for that site to delete `src/styles/global.css` + its inline utility soup and `@import` this framework instead. Also set the browser UI colour in ``: diff --git a/adapters/bulma.css b/adapters/bulma.css index 15fc914..2c7a4de 100644 --- a/adapters/bulma.css +++ b/adapters/bulma.css @@ -94,9 +94,23 @@ hr { background-color: var(--color-border); } .notification.is-danger.is-light { background-color: #3a1620; color: #ffd0d9; border-color: #5b2230; } .notification.is-warning.is-light { background-color: #3a2c10; color: #ffe1a8; border-color: #5b471d; } +/* Progress bars — dark track + accent fill (native needs pseudo-els) */ +.progress { background-color: var(--color-surface-2); border-radius: 999px; height: 0.6rem; } +.progress::-webkit-progress-bar { background-color: var(--color-surface-2); border-radius: 999px; } +.progress::-webkit-progress-value { background-color: var(--color-accent); border-radius: 999px; } +.progress::-moz-progress-bar { background-color: var(--color-accent); border-radius: 999px; } +.progress.is-info::-webkit-progress-value { background-color: var(--color-accent); } +.progress.is-info::-moz-progress-bar { background-color: var(--color-accent); } +.progress.is-success::-webkit-progress-value { background-color: var(--color-good); } +.progress.is-success::-moz-progress-bar { background-color: var(--color-good); } +.progress:indeterminate { background-image: linear-gradient(to right, var(--color-accent) 30%, var(--color-surface-2) 30%); } + /* Media object (list items) */ .media + .media { border-top: 1px solid var(--color-border); } .media-left img { border-radius: var(--wt-radius-sm); border: 1px solid var(--color-border); background: #fff; } +/* flex children need min-width:0 to shrink — otherwise long names/URLs push the + whole page wider than the viewport (sideways scroll on mobile). */ +.media-content { min-width: 0; overflow-wrap: anywhere; } /* Misc */ details summary { color: var(--color-accent); } diff --git a/weirsoe-theme.css b/weirsoe-theme.css index 6484698..28441b4 100644 --- a/weirsoe-theme.css +++ b/weirsoe-theme.css @@ -78,6 +78,9 @@ body { background-color: var(--color-bg); color: var(--color-text); font-family: var(--wt-font-sans); + /* never let a long word / wide child cause a sideways scroll on mobile */ + overflow-x: hidden; + overflow-wrap: break-word; } /* smooth cross-fade when toggling theme */ body, header, a, span, div, p, h1, h2, h3, li, ul, input, button, svg, @@ -255,145 +258,3 @@ body::before { .prose hr { border-color: var(--color-border); } .prose table { width: 100%; border-collapse: collapse; } .prose th, .prose td { border: 1px solid var(--color-border); padding: 0.5rem 0.7rem; text-align: left; } - -/* ============================================================================ - Reusable app-shell primitives (added for the weircon.dk portal; generic - enough for any card-based site). All built on the --color-* tokens above. - ========================================================================== */ - -/* ---------- card grid ---------- */ -.wt-grid { - display: grid; gap: 0.9rem; - grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); -} -.wt-grid--tight { gap: 0.55rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); } - -/* ---------- tile: icon launch card (app launcher) ---------- */ -.wt-tile { - position: relative; display: flex; flex-direction: column; - min-height: 7.25rem; height: 100%; - background: color-mix(in srgb, var(--color-surface) 70%, transparent); - border: 1px solid var(--color-border); border-radius: var(--wt-radius); - padding: 1.1rem 1.15rem; text-decoration: none; color: inherit; - transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease; -} -a.wt-tile:hover, .wt-tile--hover:hover { - border-color: var(--color-accent); transform: translateY(-3px); - background: color-mix(in srgb, var(--color-surface) 92%, transparent); -} -.wt-tile-head { display: flex; align-items: center; gap: 0.65rem; } -.wt-tile-ico { - flex: 0 0 auto; width: 2.1rem; height: 2.1rem; border-radius: 0.6rem; - display: grid; place-items: center; font-weight: 700; font-size: 1rem; overflow: hidden; - background: color-mix(in srgb, var(--color-accent) 16%, transparent); color: var(--color-accent); -} -.wt-tile-ico img { width: 100%; height: 100%; object-fit: contain; } -.wt-tile-name { font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; } -.wt-tile-sub { - color: var(--color-muted); font-size: 0.86rem; margin-top: 0.6rem; flex: 1; - white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -} -.wt-tile-go { color: var(--color-accent); font-size: 0.8rem; margin-top: 0.7rem; opacity: 0.85; } - -/* ---------- stat card ---------- */ -.wt-stat { - background: color-mix(in srgb, var(--color-surface) 70%, transparent); - border: 1px solid var(--color-border); border-radius: var(--wt-radius); padding: 1.3rem; -} -.wt-stat-n { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; } -.wt-stat-label { color: var(--color-muted); font-size: 0.85rem; } - -/* ---------- lead paragraph ---------- */ -.wt-lead { color: var(--color-muted); font-size: 1.05rem; max-width: 46rem; } - -/* ---------- search field (input with a leading icon) ---------- */ -.wt-field { position: relative; } -.wt-field-ico { - position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); - color: var(--color-muted); pointer-events: none; -} -.wt-field .wt-input { width: 100%; padding-left: 2.2rem; } - -/* ---------- notice / flash banner ---------- */ -.wt-flash { - border-radius: var(--wt-radius-sm); padding: 0.65rem 0.95rem; margin: 1rem 0; font-size: 0.9rem; - background: color-mix(in srgb, var(--color-accent) 12%, transparent); - border: 1px solid var(--color-accent); color: var(--color-accent); -} -.wt-flash--error { - background: color-mix(in srgb, var(--color-bad) 14%, transparent); - border-color: var(--color-bad); color: var(--color-bad); -} - -/* ---------- data table ---------- */ -.wt-table { width: 100%; border-collapse: collapse; } -.wt-table th, .wt-table td { border: 1px solid var(--color-border); padding: 0.45rem 0.55rem; text-align: left; } -.wt-table th { - color: var(--color-muted); font-weight: 600; font-size: 0.8rem; - text-transform: uppercase; letter-spacing: 0.06em; -} - -/* ---------- toolbar + segmented toggle ---------- */ -.wt-toolbar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin: 1.4rem 0 0.2rem; } -.wt-segment { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--wt-radius-sm); overflow: hidden; } -.wt-segment button { - background: transparent; color: var(--color-muted); border: 0; - padding: 0.5rem 0.9rem; cursor: pointer; font: inherit; font-size: 0.88rem; -} -.wt-segment button.is-on { background: var(--color-surface-2); color: var(--color-text); } - -/* ---------- selectable (checkbox) card ---------- */ -.wt-select-card { - position: relative; display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; - border: 1px solid var(--color-border); border-radius: var(--wt-radius-sm); - background: color-mix(in srgb, var(--color-surface) 70%, transparent); cursor: pointer; min-width: 0; - transition: border-color 0.15s, background 0.15s; -} -.wt-select-card:hover { border-color: var(--color-accent); } -.wt-select-card input { position: absolute; opacity: 0; pointer-events: none; } -.wt-select-card:has(input:checked) { - border-color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 12%, transparent); -} -.wt-select-card-ini { - flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 0.5rem; display: grid; place-items: center; - font-weight: 700; font-size: 0.85rem; background: color-mix(in srgb, var(--color-accent) 16%, transparent); color: var(--color-accent); -} -.wt-select-card-body { min-width: 0; flex: 1; } -.wt-select-card-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } -.wt-select-card-sub { color: var(--color-muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } -.wt-select-card-chk { - flex: 0 0 auto; width: 1.25rem; height: 1.25rem; border: 1.5px solid var(--color-border); border-radius: 0.35rem; - display: grid; place-items: center; color: transparent; font-size: 0.8rem; font-weight: 700; -} -.wt-select-card:has(input:checked) .wt-select-card-chk { - background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); -} - -/* ---------- command palette (⌘K) ---------- */ -.wt-palette { - position: fixed; inset: 0; z-index: 100; - background: color-mix(in srgb, var(--color-bg) 60%, transparent); - -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); - display: flex; align-items: flex-start; justify-content: center; padding-top: 15vh; -} -.wt-palette[hidden] { display: none; } -.wt-palette-box { - width: min(36rem, calc(100vw - 2rem)); border: 1px solid var(--color-border); border-radius: var(--wt-radius); - background: var(--color-surface); box-shadow: var(--wt-shadow-hover); overflow: hidden; -} -.wt-palette-input { - width: 100%; padding: 0.9rem 1.1rem; font-size: 1rem; background: transparent; color: var(--color-text); - border: 0; outline: none; border-bottom: 1px solid var(--color-border); -} -.wt-palette-list { max-height: 50vh; overflow-y: auto; padding: 0.35rem; margin: 0; list-style: none; } -.wt-palette-item { - display: flex; justify-content: space-between; align-items: center; gap: 1rem; - padding: 0.55rem 0.8rem; border-radius: var(--wt-radius-sm); cursor: pointer; font-size: 0.925rem; -} -.wt-palette-item.is-selected, .wt-palette-item:hover:not(.wt-palette-empty) { background: var(--color-surface-2); } -.wt-palette-empty { color: var(--color-muted); cursor: default; } -.wt-palette-badge { - font-size: 0.7rem; color: var(--color-muted); border: 1px solid var(--color-border); - border-radius: 999px; padding: 0.05rem 0.5rem; -} -.wt-palette-hint { padding: 0.5rem 1.1rem; font-size: 0.72rem; color: var(--color-muted); border-top: 1px solid var(--color-border); }