oficina / slides Public

Clone
git clone https://amadan.net/oficina/slides

Plain git — no account needed to clone.

Download

Download this file

1/* light.css — the light, for Slides: Docs' brand/light.css (design/
2 richer-ui, at "a press is press in and bloom, with no dark mark" and
3 "every glow much fainter in dark mode"), on Slides' own attributes and
4 accent. A page opts in by linking this and brand/pointer.js; nothing
5 here does anything to a page that does not.
6
7 The vocabulary, all opt-in, all generic:
8
9 [slides-lit] a surface a pool of the accent's light follows the
10 pointer across (a list row, a menu item, a panel),
11 and a press blooms on.
12 [slides-press] a control that gives a little under a press and
13 springs back, overshooting slightly. Its scale is
14 --slides-press-scale (0.965 by default).
15 [slides-lift] a tile whose [slides-lift-face] (its picture) is
16 picked up: it lifts toward the reader a little
17 larger, takes the accent's edge, leans a few degrees
18 toward the pointer, carries the light, and gives
19 under a press.
20 [rst-btn] rastrillo's buttons on such a page press in and
21 bloom too: white on a filled button. This rastrillo
22 has no press value or face layer of its own (Docs'
23 newer one does), so the bloom rides here.
24
25 Positions come from pointer.js: --rst-mx/--rst-my (the pointer, in
26 the element's own pixels: rastrillo light.js's names, so one
27 vocabulary lights both), --slides-tx/--slides-ty (the same, -1 to 1
28 across the element, for the lean), and --rst-px/--rst-py (where a
29 press landed). Every one has a default here, so with no script the
30 page is the still design. Hover light only under (hover: hover), so a
31 touch screen never holds a light where a finger lifted; motion is
32 dropped under reduced motion, where the edge alone says the same
33 thing.
34
35 In dark every glow is far fainter: light on a dark surface reads much
36 brighter than on a light one (Paul, 2026-11-10). */
37:root {
38 /* The bloom's light, as an rgb triplet so its alpha can follow the
39 press: rgb(var() / calc()) works in every engine, where a
40 color-mix() whose percentage carried calc(var()) blanked Safari.
41 Slides' accent (estilo theme/apps.go, hue 56), light and dark. */
42 --slides-bloom: 146 75 0;
43 /* How strong every bloom is: 1 in light, much less in dark. */
44 --slides-bloom-k: 1;
45 /* The pool of light a pointer casts on what it is over. */
46 --slides-light-tint: light-dark(color-mix(in srgb, var(--rst-accent) 10%, transparent), color-mix(in srgb, var(--rst-accent) 6%, transparent));
47}
48/* Dark, a triplet, so a selector and a media query rather than
49 light-dark(), which takes only colours. */
50:root[data-theme="dark"] { --slides-bloom: 235 156 98; --slides-bloom-k: 0.4; }
51@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --slides-bloom: 235 156 98; --slides-bloom-k: 0.4; } }
52
53/* A press is press in and bloom: the control gives under the press and
54 springs back on release; the light flares where the press landed,
55 swelling while it is held and fading after release. --slides-press is
56 1 while held, at once, and falls to 0 over 0.7s, which a registered
57 number can transition; the flare's size and alpha both ride it.
58 Inherited, so a lifted tile's face reads its tile's press. */
59@property --slides-press {
60 syntax: "<number>";
61 inherits: true;
62 initial-value: 0;
63}
64:root {
65 --slides-flare: radial-gradient(calc(24px + var(--slides-press, 0) * 76px) circle at var(--rst-px, 50%) var(--rst-py, 50%), rgb(var(--slides-bloom) / calc(var(--slides-press, 0) * 0.16 * var(--slides-bloom-k))), transparent 72%);
66 --slides-flare-on-fill: radial-gradient(calc(24px + var(--slides-press, 0) * 96px) circle at var(--rst-px, 50%) var(--rst-py, 50%), rgb(255 255 255 / calc(var(--slides-press, 0) * 0.22 * var(--slides-bloom-k))), transparent 72%);
67 --slides-release: --slides-press 0.7s cubic-bezier(0.2, 0.6, 0.3, 1), scale 0.42s cubic-bezier(0.3, 1.6, 0.5, 1);
68}
69
70[slides-lit],
71[slides-press],
72[slides-lift],
73[rst-btn] {
74 transition: var(--slides-release), background-color 150ms ease, border-color 150ms ease, color 150ms ease;
75}
76[slides-lit]:active,
77[slides-press]:active:not(:disabled):not([aria-disabled="true"]),
78[slides-lift]:active,
79[rst-btn]:active:not(:disabled):not([aria-busy="true"]) {
80 --slides-press: 1;
81 transition: scale 90ms ease-out;
82}
83[slides-press]:active:not(:disabled):not([aria-disabled="true"]) { scale: var(--slides-press-scale, 0.965); }
84[rst-btn]:active:not(:disabled):not([aria-busy="true"]) { scale: 0.965; }
85[slides-lit] { background-image: var(--slides-flare); }
86[slides-press]:not([slides-lit]),
87[rst-btn] { background-image: var(--slides-flare); }
88[rst-btn~="primary"],
89[rst-btn~="danger"] { background-image: var(--slides-flare-on-fill); }
90
91@media (hover: hover) {
92 /* The second selector is a rastrillo row: its own hover fill is a
93 background shorthand under a :has() that outweighs the first, and
94 would take the light away exactly while the pointer is on it. */
95 [slides-lit]:hover,
96 [rst-row][slides-lit]:has(> [rst-row-main] > a):hover {
97 background-image: var(--slides-flare), radial-gradient(var(--slides-light-size, 280px) circle at var(--rst-mx, 50%) var(--rst-my, 50%), var(--slides-light-tint), transparent 70%);
98 }
99}
100
101/* The lifted tile. The face is what moves: the tile itself (a link,
102 title and all) stays where it is, so its hit area never slides out
103 from under the pointer. The lean's transition is what makes it follow
104 the pointer rather than jump. */
105[slides-lift] [slides-lift-face] {
106 position: relative;
107 transition: transform 180ms cubic-bezier(.2, .7, .2, 1), box-shadow 180ms ease, scale 0.42s cubic-bezier(0.3, 1.6, 0.5, 1);
108}
109[slides-lift] [slides-lift-face]::after {
110 content: "";
111 position: absolute;
112 inset: 0;
113 border-radius: inherit;
114 background:
115 var(--slides-flare),
116 radial-gradient(180px circle at var(--rst-mx, 50%) var(--rst-my, 0%), var(--slides-light-tint), transparent 70%);
117 opacity: 0;
118 transition: opacity 200ms ease;
119 pointer-events: none;
120}
121[slides-lift]:active [slides-lift-face]::after {
122 opacity: 1;
123}
124[slides-lift]:hover [slides-lift-face],
125[slides-lift]:focus-visible [slides-lift-face] {
126 transform: translateY(-6px) perspective(800px)
127 rotateX(calc(var(--slides-ty, 0) * -4deg))
128 rotateY(calc(var(--slides-tx, 0) * 5deg))
129 scale(1.04);
130 box-shadow:
131 0 0 0 1.5px var(--rst-accent),
132 0 2px 4px rgb(23 32 60 / 0.08),
133 0 18px 32px -14px light-dark(rgb(23 32 60 / 0.35), rgb(0 0 0 / 0.8));
134}
135[slides-lift]:active [slides-lift-face] {
136 scale: 0.97;
137 transition: transform 180ms cubic-bezier(.2, .7, .2, 1), box-shadow 180ms ease, scale 90ms ease-out;
138}
139@media (hover: hover) {
140 [slides-lift]:hover [slides-lift-face]::after {
141 opacity: 1;
142 }
143}
144
145@media (prefers-reduced-motion: reduce) {
146 [slides-press]:active, [rst-btn]:active, [slides-lift]:active [slides-lift-face] { scale: none; }
147 [slides-lift] [slides-lift-face] { transition: none; }
148 [slides-lift]:hover [slides-lift-face],
149 [slides-lift]:focus-visible [slides-lift-face] { transform: none; }
150}
151@media (forced-colors: active) {
152 [slides-lit], [slides-press], [rst-btn] { background-image: none; }
153 [slides-lift] [slides-lift-face]::after { content: none; }
154}
155