~bigbes/sr-ht-spec

ref: c2dd1ef94a971405ff2ab1c048f9e74e0ef0b844 sr-ht-spec/scss/main.scss -rw-r--r-- 9.1 KiB
c2dd1ef9 — Eugene Blikh chore(beads): Phase 5b closed, spec-ar4 blocked on phoebe host access 24 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
// spec.sr.ht stylesheet.
//
// Mirrors the SourceHut service pattern (see paste.sr.ht/scss/main.scss and
// compare.sr.ht/scss/main.scss): pull in the shared `base` partial (Bootstrap 4
// plus the SourceHut chrome — contrast, variables, nav, events, highlight,
// dark) and then add only what is unique to the document views.
//
// Build: `make css`, which is `sassc -I /usr/share/sourcehut/scss scss/main.scss`
// plus minify plus a content-hashed filename. The shared partials come from
// core.sr.ht's `make install`; dart-sass works too for a local build.
//
// The output is EMBEDDED INTO THE BINARY (web/templates.go's //go:embed static),
// so `make css` alone does not restyle a running daemon: build the CSS, then
// `go build`, then restart.

@import "base";

// Let scheme-aware widgets follow prefers-color-scheme, as compare.sr.ht does.
:root {
  color-scheme: light dark;
}

// ---- Rendered document ----------------------------------------------------

.spec-doc {
  // Prose, not code: a comfortable measure matters more than filling the
  // column. The sidebar already takes a quarter of the width, so this only
  // bites on very wide screens.
  max-width: 46rem;

  h1, h2, h3, h4, h5, h6 {
    margin-top: 1.5rem;
  }

  // The first heading sits directly under the page title; the extra top margin
  // reads as a gap rather than as structure.
  > :first-child {
    margin-top: 0;
  }

  blockquote {
    padding-left: 0.75rem;
    border-left: 3px solid $gray-400;
    color: $gray-700;

    @media (prefers-color-scheme: dark) {
      border-left-color: $gray-700;
      color: $gray-300;
    }
  }

  table {
    @extend .table;
    width: auto;
  }

  img {
    max-width: 100%;
  }
}

// A wikilink that resolved to nothing. The renderer emits it as a span rather
// than dropping it, so the read plane doubles as a link checker — which only
// works if it is visibly different from a link that resolved.
.wikilink-missing {
  color: $danger;
  text-decoration: line-through dotted;
}

// ---- Search ---------------------------------------------------------------

.search-hit {
  margin-bottom: 0.75rem;
}

.search-snippet {
  color: $gray-700;

  // bleve wraps matched terms in <mark>; the browser default is a yellow that
  // is unreadable on the dark chrome.
  mark {
    padding: 0;
    background: transparent;
    color: inherit;
    font-weight: 700;
  }

  @media (prefers-color-scheme: dark) {
    color: $gray-300;
  }
}

// ---- Proposal review ------------------------------------------------------

.proposal-actions {
  margin: 1rem 0;

  form {
    margin-right: 0.5rem;
  }
}

.proposal-doc {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid $gray-300;

  @media (prefers-color-scheme: dark) {
    border-top-color: $gray-700;
  }
}

// ---- Prose diff -----------------------------------------------------------
//
// The renderer (web/diff.go) emits this markup: a hunk per heading path, a
// block per change, and inline <del>/<ins> spans or a two-column view depending
// on how badly the block was rewritten. Colours follow Bootstrap's success and
// danger so added and removed read the same here as everywhere else.
//
// Every block of the proposed document is on the page, because every block can
// be commented on — so the visual weight is what keeps this a diff rather than a
// document dump. A changed block is bordered, tinted and full size; an unchanged
// one is a collapsed, dimmed, borderless line. That contrast is load-bearing:
// remove it and a reviewer can no longer see at a glance what the agent did.

.prosediff {
  font-size: 0.95rem;

  .ph-hunk {
    margin-bottom: 1rem;
  }

  .ph-path {
    font-family: $font-family-monospace;
    font-size: 0.8rem;
    color: $gray-600;
    padding: 0.15rem 0;

    @media (prefers-color-scheme: dark) {
      color: $gray-400;
    }
  }

  .ph-block {
    padding: 0.35rem 0.6rem;
    margin: 0.2rem 0;
    border-left: 3px solid transparent;
    border-radius: 2px;
  }

  .ph-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: $gray-600;
    margin-bottom: 0.15rem;

    @media (prefers-color-scheme: dark) {
      color: $gray-400;
    }
  }

  .ph-insert {
    border-left-color: $success;
    background: rgba($success, 0.08);
  }

  .ph-delete {
    border-left-color: $danger;
    background: rgba($danger, 0.08);
  }

  .ph-modify {
    border-left-color: $gray-400;
    background: rgba($gray-500, 0.06);
  }

  .ph-move {
    border-left-color: $info;
    color: $gray-600;
    font-style: italic;
  }

  // Unchanged text: present, addressable, and deliberately quiet. It is a
  // <details> collapsed to one line, so a long untouched section costs a few
  // dim rows rather than screens of prose between the changes.
  .ph-context {
    padding: 0;
    margin: 0;
    border-left-color: transparent;
    color: $gray-600;

    @media (prefers-color-scheme: dark) {
      color: $gray-500;
    }

    > .ph-context-label {
      padding: 0.1rem 0.6rem;
      font-size: 0.85rem;
      cursor: pointer;
      list-style-position: outside;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    // Expanded, it indents under its own summary and stays uncoloured: it is
    // still context, even while being read.
    > .ph-body,
    > .ph-code,
    > .ph-threads,
    > .ph-form {
      margin-left: 1.2rem;
    }

    &[open] > .ph-context-label {
      color: $gray-700;

      @media (prefers-color-scheme: dark) {
        color: $gray-400;
      }
    }
  }

  // Inline marks: a deletion is struck through in danger, an insertion is
  // underlined in success. Both keep a faint background so a one-word change is
  // visible without reading the colour.
  del {
    text-decoration: line-through;
    color: $danger;
    background: rgba($danger, 0.12);
    text-decoration-thickness: 1px;
  }

  ins {
    text-decoration: none;
    color: darken($success, 8%);
    background: rgba($success, 0.14);

    @media (prefers-color-scheme: dark) {
      color: lighten($success, 8%);
    }
  }

  // The two-column fallback for shredded blocks: old on the left, new on the
  // right, stacking on a narrow screen so it never overflows the page.
  .ph-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .ph-col {
    flex: 1 1 20rem;
    min-width: 0;
    padding: 0.4rem 0.6rem;
    border-radius: 2px;
  }

  .ph-old {
    background: rgba($danger, 0.06);
  }

  .ph-new {
    background: rgba($success, 0.06);
  }

  // Code / frontmatter line diffs keep their wrapping and are read line by line.
  .ph-code {
    margin: 0;
    padding: 0.25rem 0;
    background: transparent;
    white-space: pre-wrap;
    word-break: break-word;

    .ph-line-del {
      display: block;
      background: rgba($danger, 0.1);
    }

    .ph-line-ins {
      display: block;
      background: rgba($success, 0.1);
    }
  }
}

// ---- Review threads -------------------------------------------------------
//
// Rendered both inside a diff block (web/diff.go executes "blockthreads" into
// the block's markup) and, for comments whose anchor is lost, in the page's own
// area — so these styles are outside .prosediff and apply in both places.

.ph-threads {
  margin: 0.35rem 0 0.15rem;
}

.ph-thread {
  margin: 0.35rem 0;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid $info;
  background: rgba($info, 0.06);
  border-radius: 2px;

  // A resolved thread is history: it stays readable and stays where it was, but
  // stops asking for attention the way an open one does.
  &.ph-thread-resolved {
    border-left-color: $gray-400;
    background: transparent;
    opacity: 0.7;
  }
}

.ph-thread-head {
  font-size: 0.8rem;
  margin-bottom: 0.2rem;

  .ph-author {
    font-weight: 700;
  }

  .ph-when {
    color: $gray-600;
    margin-left: 0.35rem;

    @media (prefers-color-scheme: dark) {
      color: $gray-400;
    }
  }

  .badge {
    margin-left: 0.35rem;
  }
}

// A comment is prose someone typed, newlines included; the server escapes it and
// the browser must not then reflow it into one paragraph.
.ph-comment-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.ph-reply {
  margin-top: 0.4rem;
  padding-left: 0.6rem;
  border-left: 2px solid $gray-400;

  @media (prefers-color-scheme: dark) {
    border-left-color: $gray-700;
  }
}

.ph-thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

// The compose and reply forms fold away behind a summary: the review page shows
// one control per block, and a textarea per block would bury the diff.
.ph-form {
  font-size: 0.85rem;

  > summary {
    cursor: pointer;
    color: $gray-600;

    @media (prefers-color-scheme: dark) {
      color: $gray-400;
    }
  }

  textarea {
    margin: 0.3rem 0;
  }
}

.ph-compose {
  margin: 0.2rem 0 0.4rem;
}

// Comments whose block is gone. The warning border is the point: they are shown
// because dropping them would hide a critique, and marked because they no longer
// describe anything on this page.
.ph-lost {
  border-top-color: $warning;

  .ph-thread {
    border-left-color: $warning;
    background: rgba($warning, 0.06);
  }
}