aboutsummaryrefslogtreecommitdiffstats
path: root/assets/css/scroll-to-top.css
diff options
context:
space:
mode:
authorsillylaird <sillyfanboy@gmail.com>2026-09-03 00:33:59 +0000
committersillylaird <sillyfanboy@gmail.com>2026-09-03 00:33:59 +0000
commit898b52edcb47bcb3e9d6106e74ca73e74ea01e70 (patch)
tree85c6ee5ad58b860144551184d4cf86b560c62b91 /assets/css/scroll-to-top.css
downloadwww-main.tar.gz
www-main.zip
import live www.sillylaird.ca webrootHEADmain
Diffstat (limited to '')
-rw-r--r--assets/css/scroll-to-top.css162
1 files changed, 162 insertions, 0 deletions
diff --git a/assets/css/scroll-to-top.css b/assets/css/scroll-to-top.css
new file mode 100644
index 0000000..e538251
--- /dev/null
+++ b/assets/css/scroll-to-top.css
@@ -0,0 +1,162 @@
+/* ==========================================================================
+ scroll-to-top.css — floating "back to top" control
+ Loaded by assets/js/scroll-to-top.js on www and sibling *.sillylaird.ca hosts.
+ Self-contained so sibling pages that do not load site.css still look right.
+ Selectors are more specific than site.css's `a:hover` so the global link
+ glow / scale does not leak onto the control.
+ ========================================================================== */
+
+a.scroll-to-top {
+ --stt-bg: var(--bg, #000000);
+ --stt-ink: var(--gold, #8b0000);
+ --stt-border: var(--border, #3a0000);
+ --stt-hover: var(--accent-cyan, #8b0000);
+ position: fixed;
+ right: max(0.85rem, env(safe-area-inset-right, 0px));
+ bottom: max(1.1rem, env(safe-area-inset-bottom, 0px));
+ z-index: 10050;
+ box-sizing: border-box;
+ width: 2.75rem;
+ height: 2.75rem;
+ margin: 0;
+ padding: 0.2rem 0 0.15rem;
+ display: inline-flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 0.05rem;
+ border: 1px solid var(--stt-border);
+ border-radius: 6px;
+ background: var(--stt-bg);
+ color: var(--stt-ink);
+ font-family: "JetBrains Mono", "IBM Plex Mono", "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
+ font-size: 0.58rem;
+ font-weight: 700;
+ letter-spacing: 0.14em;
+ line-height: 1;
+ text-decoration: none;
+ text-transform: uppercase;
+ text-shadow: none;
+ box-shadow:
+ 0 0 0 1px rgba(160, 0, 0, .18),
+ 0 0 14px -2px rgba(160, 0, 0, .4),
+ inset 0 0 10px rgba(160, 0, 0, .12);
+ opacity: 0;
+ visibility: hidden;
+ pointer-events: none;
+ transform: translateY(10px);
+ transition:
+ opacity .2s ease,
+ visibility .2s ease,
+ transform .2s ease,
+ color .15s ease,
+ border-color .15s ease,
+ box-shadow .25s ease,
+ background-color .15s ease;
+ touch-action: manipulation;
+ -webkit-tap-highlight-color: transparent;
+}
+
+a.scroll-to-top.is-visible {
+ opacity: 1;
+ visibility: visible;
+ pointer-events: auto;
+ transform: none;
+}
+
+a.scroll-to-top .scroll-to-top-caret {
+ font-size: 0.85rem;
+ letter-spacing: 0;
+ line-height: 1;
+ transform: translateY(1px);
+}
+
+a.scroll-to-top .scroll-to-top-label {
+ font-size: 0.52rem;
+ letter-spacing: 0.16em;
+}
+
+a.scroll-to-top:hover,
+a.scroll-to-top:focus-visible {
+ background: var(--stt-bg);
+ color: var(--stt-hover);
+ text-decoration: none;
+ text-shadow:
+ 0 0 6px rgba(255, 0, 0, .85),
+ 0 0 14px rgba(139, 0, 0, .45);
+ border-color: rgba(255, 0, 0, .75);
+ border-radius: 6px;
+ transform: none;
+ box-shadow:
+ 0 0 0 1px rgba(255, 0, 0, .45),
+ 0 0 16px rgba(139, 0, 0, .4),
+ 0 0 32px -6px rgba(139, 0, 0, .35),
+ inset 0 0 10px rgba(139, 0, 0, .08);
+}
+
+a.scroll-to-top:focus-visible {
+ outline: 2px solid var(--stt-hover);
+ outline-offset: 2px;
+}
+
+a.scroll-to-top:active {
+ transform: translateY(1px);
+}
+
+/* Light theme — www uses body.light-mode; blog uses data-blog-theme */
+body.light-mode a.scroll-to-top,
+html[data-blog-theme="light"] a.scroll-to-top {
+ --stt-bg: #fff8f1;
+ --stt-ink: #8b0000;
+ --stt-border: #e8c8c8;
+ --stt-hover: #5a0000;
+ box-shadow:
+ 0 1px 0 rgba(255, 255, 255, .95) inset,
+ 0 8px 22px rgba(139, 0, 0, .16);
+}
+
+body.light-mode a.scroll-to-top:hover,
+body.light-mode a.scroll-to-top:focus-visible,
+html[data-blog-theme="light"] a.scroll-to-top:hover,
+html[data-blog-theme="light"] a.scroll-to-top:focus-visible {
+ background: #ffffff;
+ color: #5a0000;
+ text-shadow: none;
+ border-color: #8b0000;
+ box-shadow:
+ 0 0 0 1px rgba(139, 0, 0, .35),
+ 0 8px 22px rgba(139, 0, 0, .22);
+}
+
+/* When the visit-counter has no footer to live in, it docks bottom-right.
+ Lift it so the two chips do not sit on top of each other. */
+body.has-scroll-to-top #site-visit-counter[data-stt-docked="1"] {
+ bottom: 4.65rem;
+}
+
+@media (max-width: 520px) {
+ a.scroll-to-top {
+ width: 2.55rem;
+ height: 2.55rem;
+ right: max(0.65rem, env(safe-area-inset-right, 0px));
+ bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
+ }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ a.scroll-to-top,
+ a.scroll-to-top.is-visible,
+ a.scroll-to-top:hover,
+ a.scroll-to-top:focus-visible,
+ a.scroll-to-top:active {
+ transition: none;
+ transform: none;
+ }
+}
+
+@media print {
+ a.scroll-to-top,
+ .footer-back-to-top {
+ display: none !important;
+ }
+}