/* humanity.zip: shared by every page. Figma UO16aUxbZB5KQEeit5W7pp: one 554.349 px column of IM Fell DW Pica, 307 px from the top.
   Every size is in em of the frame's 36 px type (frame px / 36), so the column scales as one piece and lines break where the frame breaks them.
   Lovish, 2026-12-04: 24 px type with a little more leading than the frame's 36/45. */
:root {
  --page: #FFFFFF; --ink: #000000; --line: #E5E5E5; --hl: #FFE45C; --hl-coat: #F2A800;
  --fs: min(24px, calc((100vw - 48px) * .064941)); /* .064941 = 36 / 554.349 */
  --lh: 1.35;
  /* A book page, so the grid is the type's own unit: a line every half em (18 frame px), 31 columns of 14.349 with 3.651 gutters.
     The frames' indents all sit on it: the lists hang at 1.5em and 2.5em. */
  --grid-cols: 31; --grid-gutter: calc(var(--fs) * .101417); --grid-margin: 24px; --grid-max: calc(var(--fs) * 15.39858);
  color-scheme: light;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scrollbar-gutter: stable; background: var(--page); }
body { transition: opacity .35s ease-out; }
html.hold body { opacity: 0; }
@media (prefers-reduced-motion: reduce) { body { transition: none; } }
body { background: var(--page); color: var(--ink); font-family: "IM Fell DW Pica", ui-serif, Georgia, serif; -webkit-font-smoothing: antialiased; }

article { position: relative; isolation: isolate; width: var(--grid-max); margin: 0 auto; font-size: var(--fs); line-height: var(--lh); padding: 8.52667em 0; }
h1, h2 { font: inherit; text-wrap: balance; }
/* Back: the personal site's fixed .icon button, in the top-left corner (Lovish, 2026-12-04). The page colour behind it, so text scrolling under it on a phone does not show through. */
.back { position: fixed; z-index: 2; top: 16px; left: 16px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--page); color: var(--ink); transition: background .15s; }
.back::before { content: ""; position: absolute; inset: -6px; } /* 44px hit area */
.back:hover { background: var(--line); }
.back svg { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
@media (pointer: coarse) { .back { display: none; } } /* touch screens swipe back (Lovish, 2026-12-04) */
em { font-style: italic; } /* slop-lint-disable-line web-bar: Lovish 2026-12-04, only "humanity" and "intelligence" are ever italic */
/* The frame's ornament: a fleuron, a rule, the fleuron mirrored. .flip turns it upside down, as the frame does above a passage. */
.orn { display: block; width: 15.39858em; height: 1.04em; overflow: visible; }

/* From the personal site. Ink behaves: it draws, presses and spreads. Paper slides. Nothing glows, scales or bounces. */
::selection { background: var(--line); } /* a pencil mark, not the system blue */

/* Underlines, as on the personal site (Lovish, 2026-12-04: "same as the personal website where they come in on hover").
   No underline at rest. On hover a pen draws one in: each phrase gets its own slightly uneven stroke (made by penLines()),
   drawn at a hand's pace, slow to land, quick through the middle, slow to lift. */
.u { position: relative; white-space: nowrap; } /* one stroke per phrase, so a phrase never splits across lines */
.pen { position: absolute; left: 0; bottom: -.5px; width: 100%; height: 6px; overflow: visible; pointer-events: none; filter: url(#ink);
  fill: none; stroke: var(--ink); stroke-width: 1.25; stroke-linecap: round; stroke-dasharray: 1 2; stroke-dashoffset: 1; opacity: 0;
  transition: opacity .25s, stroke-dashoffset 0s .25s; }
/* Ink stays: once a pen has drawn a mark, it stays on the page (the script adds .inked on the first hover). */
.u.inked > .pen, .u:hover > .pen { opacity: 1; stroke-dashoffset: 0; transition: stroke-dashoffset .42s cubic-bezier(.6, .05, .3, 1), opacity 0s; }
@media (prefers-reduced-motion: reduce) { .pen, .u:hover > .pen { transition: none; } }

/* Highlighter: in paragraphs the selection itself is clear, because the yellow mark is drawn live under the drag.
   Marks sit behind the text, roughened and streaked by the #marker filter, and stay (the script keeps them). */
html.penned article :not(.cmd, .cmd *)::selection { background: transparent; }
.row { -webkit-user-drag: none; } /* a drag across a row selects its words; it never drags the link */
.marks { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; overflow: visible; pointer-events: none; }
.marks g { fill: var(--hl); filter: url(#marker); }
.marks .ink { mix-blend-mode: darken; } /* a stroke never lifts ink already down: only a coat changes it, and only darker */
.marks .coat { fill: var(--hl-coat); mix-blend-mode: multiply; } /* a deeper ink, as a second coat soaks in */
/* Wet to dry: a new coat goes down at 40% of its dry depth straight away, then dries to the full colour.
   As it dries the ink bleeds a little into the paper: its edge spreads by a fraction of a pixel and stays. */
.marks .ink { stroke: var(--hl); stroke-width: 1.4px; }
.marks .coat { stroke: var(--hl-coat); stroke-width: 1.4px; opacity: var(--o); } /* --o: this coat's strength, 30% less for each coat under it */
.marks .coat.fresh { opacity: calc(var(--o) * 2 / 5); stroke-width: 0; }
.marks .ink.fresh { stroke-width: 0; }
.marks .coat.wet { animation: dry 1.8s cubic-bezier(.3, .1, .3, 1) both, bleed 1.8s ease-out both; }
.marks .ink.wet { animation: bleed 1.8s ease-out both; }
@keyframes dry { from { opacity: calc(var(--o) * 2 / 5); } }
@keyframes bleed { from { stroke-width: 0; } }
@media (prefers-reduced-motion: reduce) { .marks .wet { animation: none; } }

/* Hierarchy and page turns, ported from the personal site (PersonalWebsite/index.html; Lovish, 2026-12-04:
   "use the page changes from the original personalsite project"). Sizes are its 18 px scale in em: notes 15/18. */
:root { --ink2: #757575; --well: #F5F5F5; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
.scene, .parts h2 { letter-spacing: .05em; text-transform: uppercase; } /* headings: capitals in the text face, tracked, never bigger */
.note { color: var(--ink2); font-size: .83333em; line-height: 1.46667; text-wrap: pretty; } /* side matter: the text face, smaller and grey */
.note a { color: var(--ink); }

/* Contents rows: a title, dot leaders, and its end. On hover the dots go over again in ink, one strike per dot. */
.rows { margin-top: calc(var(--lh) * 1em); }
.row { display: block; padding: .375em 0; }
.row .head { display: flex; align-items: baseline; }
.row .head span:first-child { min-width: 0; }
.row .dots { position: relative; flex: 1; min-width: 1.5em; height: 3px; margin: 0 calc(var(--fs) * var(--end, 4.39858) * -1) 0 .35em; color: var(--ink2);
  background: radial-gradient(circle, currentColor .9px, transparent 1.3px) left bottom / 7px 3px repeat-x; } /* slop-lint-disable-line web-bar: the personal site's dot leaders, Lovish 2026-12-04 */
.row .dots::after { content: ""; position: absolute; inset: 0; width: 0; opacity: 0; transition: opacity .2s, width 0s .2s;
  background: radial-gradient(circle, var(--ink) .9px, transparent 1.3px) left bottom / 7px 3px repeat-x; }
.row.inked .dots::after, .row:hover .dots::after, .row:focus-visible .dots::after { width: 100%; opacity: 1; transition: width .22s steps(var(--n, 30), end), opacity 0s; }
.row .end { position: relative; flex-shrink: 0; width: calc(var(--fs) * var(--end, 4.39858)); text-align: right; color: var(--ink2); } /* a fixed box in page units, so its left edge sits on a column line at any type size (the pitch is .5 of --fs) */
.row .end > span { background: var(--page); padding-left: .35em; } /* the leaders run under the box and stop at the word */
/* the end word takes the pen line, drawn in when the row is hovered, and kept once inked like the leaders */
.row .end .pen { left: .35em; width: calc(100% - .35em); }
.row:is(.inked, :hover, :focus-visible) .end .pen { opacity: 1; stroke-dashoffset: 0; transition: stroke-dashoffset .42s cubic-bezier(.6, .05, .3, 1), opacity 0s; }

/* A command: Lovish's well (2026-12-04 mock, "Contribute to Humanity"). A flat grey fill, the command in the text face,
   and "copy" inside it on the right. The command wraps anywhere, so the whole address shows at every width. */
.cmd { display: flex; align-items: baseline; gap: .75em; padding: .41667em .66667em; border-radius: 8px; background: var(--well); }
.cmd code { flex: 1; min-width: 0; font: inherit; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.cmd button { flex: none; font: inherit; color: var(--ink); background: none; border: 0; padding: 0; min-height: 44px; margin: -.5em 0; cursor: pointer; }
.cmd button:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
* + .cmd, .cmd + * { margin-top: calc(var(--lh) * .5em); }
.cmd + p { margin-top: calc(var(--lh) * 1em); } /* the next step starts a new beat */

/* From the personal site's home: a divider, then a section heading (.scene). Lovish, 2026-12-04: "use dividers or indents
   like this", then "a page index style thing works best here". */
.rule { filter: url(#ink); display: block; width: calc(var(--fs) * 8.39858); height: calc(var(--fs) * .5); margin: calc(var(--lh) * 3em) auto 0; fill: none; stroke: var(--ink2); stroke-linecap: round; } /* slop-lint-disable-line web-bar: the personal site's divider, Lovish 2026-12-04 "use dividers or indents like this" */
.rule path { stroke-width: .7; }
.rule circle { stroke-width: 1; }
.scene { margin-top: calc(var(--lh) * 3em); }
.scene + *, h1 + p { margin-top: calc(var(--lh) * 1em); }
.matter { font-size: .8em; } /* everything after the essay, at 0.8 of the text size (Lovish, 2026-12-04) */
.matter .count { color: var(--ink2); }
.matter p + p { margin-top: calc(var(--lh) * 1em); }
.cmd .flag { white-space: nowrap; }
.rows + .scene { margin-top: calc(var(--lh) * 2em); } /* a second list under the same divider */

/* Letterpress: a pressed link sinks half a pixel and its ink spreads, then lifts on release. */
article a { position: relative; top: 0; transition: top .16s ease-out, text-shadow .16s ease-out; }
article a:active { top: .5px; text-shadow: .3px 0 currentColor; transition-duration: 0s; }

/* Turning a page. A fold line travels across the page from the right; the part past the fold curls back as the blank
   back of the page, shaded from its far edge to the bright bend. The next page lies beneath and takes a soft shadow
   just past the fold. Going back lays the page down again from the left. One clock (turn.js) drives the fold (--x),
   the clip of the turning page and the sheet, so they never drift apart. Here each page is its own document. */
@view-transition { navigation: auto; }
@property --x { syntax: "<length>"; inherits: true; initial-value: 0px; }
:root[data-turn] body { transition: none; } /* the arriving page is shown at once, under the turn */
/* No cross-fade blend: some engines keep plus-lighter after animation: none, and two opaque pages added together are pure white */
:root[data-turn]::view-transition-old(root), :root[data-turn]::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
/* Going forward, the fold starts at the right edge before the clock runs, so no frame shows the old page clipped away */
:root[data-turn="fwd"] { --x: 100vw; }
:root[data-turn="fwd"]::view-transition-old(root) { z-index: 1; clip-path: inset(0 calc(100vw - var(--x)) 0 0); }
:root[data-turn="back"]::view-transition-new(root) { clip-path: inset(0 calc(100vw - var(--x)) 0 0); }
::view-transition-group(turn), ::view-transition-new(turn), ::view-transition-old(turn) { animation: none; }
::view-transition-group(turn) { z-index: 2; }
.blank { position: fixed; inset: 0; z-index: 4; background: var(--page); } /* the next page, while it is a file the browser has not opened yet */
.turn { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; view-transition-name: turn; }
.turn .leaf { position: absolute; top: 0; bottom: 0; left: calc(2 * var(--x) - 100vw); width: calc(100vw - var(--x));
  background: linear-gradient(to right, var(--line), var(--page) 40%, var(--page) 90%, var(--line));
  box-shadow: -6px 0 18px rgb(0 0 0 / .07); } /* slop-lint-disable-line Lovish asked for a real page turn: the curled leaf's own shadow */
.turn .cast { position: absolute; top: 0; bottom: 0; left: var(--x); width: 56px; opacity: 0;
  background: linear-gradient(to right, rgb(0 0 0 / .11), transparent); } /* slop-lint-disable-line Lovish asked for a real page turn: the shadow the lifted leaf casts */
@media (prefers-reduced-motion: reduce) {
  article a:active { top: 0; }
  .row:hover .dots::after, .row:focus-visible .dots::after { transition: none; }
}

/* Lovish's footer, 2026-12-04: his two hands, small, and his X handle under them. The width keeps both edges on the .5em grid, as the divider's does. */
.foot { margin-top: 3lh; font-size: .8em; text-align: center; color: var(--ink2); }
.foot img { display: block; width: calc(var(--fs) * 3.39858 / .8); height: auto; margin: 0 auto; }
.foot p { margin-top: .5lh; }
.foot a { color: inherit; text-decoration: none; }
.foot a + a { margin-left: 2em; } /* X, then GitHub (Lovish, 2026-12-04); the gap keeps the two 44 px hit areas apart */
.foot a::before { content: ""; position: absolute; inset: -12px -8px; } /* a 44 px hit area round the small handle; .u is already relative */
/* Phones have no hover (Lovish, 2026-12-04: "phone links just draw underlines from the start"): every link's pen draws itself in once, and stays. */
@keyframes draw { from { opacity: 1; stroke-dashoffset: 1; } to { opacity: 1; stroke-dashoffset: 0; } }
@media (hover: none) {
  a.u > .pen, .row .end .pen { opacity: 1; stroke-dashoffset: 0; animation: draw .42s cubic-bezier(.6, .05, .3, 1) .5s backwards; }
}
@media (hover: none) and (prefers-reduced-motion: reduce) { a.u > .pen, .row .end .pen { animation: none; } }
