/* A papers site's home (tools/build.mjs planHome; the paper engine's contract, 1.5), loaded only there, after
   home.css. The password box keeps home.css's look, as every home's does. Once open (body:not(.locked)) the home is
   the papers' own room: the look "ours" (player/paper/looks/ours.css: its colours, and its faces, Paper Serif for
   the titles and the text, Paper Sans for the furniture, Paper Mono for a password), white, and that look's dark by
   the reader's system setting. An index, one paper per row: the paper's first page lying on the page with a soft
   shadow, beside it the venue and status, the title, the authors, the facts, and the password with Show and Copy
   link as one segmented control. Moving across the page shows each section's first screen (paper.js). The faces
   are the paper runtime's (player/paper/fonts/), which the build copies beside this file. The header and the cards
   show only on an open home (the lock screen hides the one and has none of the other), so only the tokens, the
   body and the root's colour scheme need the scope. */

@font-face { font-family: "Paper Serif"; src: url("fonts/paper-serif-roman.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Paper Sans"; src: url("fonts/paper-sans-roman.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Paper Mono"; src: url("fonts/paper-mono-roman.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* the room's tokens, ours's light and then its dark; home.css's own tokens follow them, so a rule of home.css that
   this file does not restate reads the room too */
body:not(.locked) {
  --ground: #ffffff; --raise: #f4f5f7; --line: #cfd5dc; --hair: #dde1e6;
  --ink: #15181c; --muted: #5a626d; --quiet: #7a828c; --focus: #0a4bb0;
  --page-edge: 0 0 0 1px #e3e6ea, 0 1px 2px rgba(20, 28, 40, .06), 0 10px 28px rgba(20, 28, 40, .10);
  --page-lift: 0 0 0 1px #d5dae0, 0 2px 4px rgba(20, 28, 40, .08), 0 16px 40px rgba(20, 28, 40, .16);
  --page-dim: 1;
  --serif: "Paper Serif", "Source Serif 4", Charter, Georgia, serif;
  --sans: "Paper Sans", "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --code: "Paper Mono", "Source Code Pro", ui-monospace, Menlo, monospace;
  --page-w: 272px; --s-home: 46px; --s-title: 31px; --s-text: 17.5px;
  --tile: var(--raise); --hi: var(--ink); --fg: var(--ink); --dim: var(--muted); --faint: var(--muted); --accent: var(--focus);
  --mono: var(--sans); --display: var(--serif);
  color: var(--ink); font: 400 var(--s-text)/1.5 var(--serif); font-optical-sizing: auto; padding-bottom: 72px;
}
:root:has(> body:not(.locked)) { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  body:not(.locked) {
    --ground: #14171b; --raise: #1a1e23; --line: #3a414b; --hair: #2a3038;
    --ink: #e5e8ec; --muted: #9ba3ae; --quiet: #838b96; --focus: #8fb6f5;
    --page-edge: 0 0 0 1px #2a3038; --page-lift: 0 0 0 1px #8fb6f5; --page-dim: .9;
  }
  :root:has(> body:not(.locked)) { color-scheme: dark; }
}
@media (max-width: 640px) {
  body:not(.locked) { --page-w: 104px; --s-home: 34px; --s-title: 19.5px; --s-text: 15.5px; }
}

/* the masthead: the home's name, its count, Lock; one rule under it */
.top, main { max-width: 1280px; margin-inline: auto; }
.top { gap: 8px 24px; padding: 48px 0 24px; margin-bottom: 32px; border-bottom: 1px solid var(--hair); }
.top .h { font: 600 var(--s-home)/1.05 var(--serif); letter-spacing: -.016em; text-transform: none; color: var(--ink); }
.top .tot { font: 400 12.5px/1.4 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }
.lock { height: 30px; padding: 0 12px; font: 500 12px/1 var(--sans); letter-spacing: .02em; color: var(--muted); border-color: var(--line); border-radius: 4px; }
.lock:hover { color: var(--ink); border-color: var(--muted); }

/* the index: one paper a row, the first page left, a hairline between papers and one closing the list */
.papers .grid { display: block; border-bottom: 1px solid var(--hair); }
.paper { display: grid; grid-template-columns: var(--page-w) minmax(0, 1fr); column-gap: 48px; padding: 0 0 48px; }
.paper + .paper { padding-top: 48px; border-top: 1px solid var(--hair); }
.paper .cover { width: var(--page-w); aspect-ratio: 4 / 5; align-self: start; border-radius: 2px; outline: 0; background: var(--raise); box-shadow: var(--page-edge); }
.paper .cover img { filter: brightness(var(--page-dim)); }
.paper:hover .cover, .paper .cover:focus-visible { outline: 0; box-shadow: var(--page-lift); }
.paper .cover:focus-visible { outline: 2px solid var(--focus); outline-offset: 5px; }
.paper .cover .at { left: 8px; right: 8px; bottom: 12px; max-width: none; padding: 3px 8px; font: 400 12px/1.4 var(--sans); color: var(--ink);
  background: color-mix(in srgb, var(--ground) 90%, transparent); border-radius: 3px; white-space: normal; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.paper .cover .at[hidden] { display: none; }
.paper .cover .strip { height: 3px; }

.paper .about { display: flex; flex-direction: column; min-width: 0; max-width: 44rem; padding-top: 2px; }
.paper .ven { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0;
  font: 500 12.5px/1.3 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.paper .st { padding: 3px 7px 2px; font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; }
.paper .st.rel { color: var(--focus); border-color: color-mix(in srgb, var(--focus) 45%, transparent); }
.paper .ttl { margin: 16px 0 0; font: 600 var(--s-title)/1.13 var(--serif); letter-spacing: -.012em; color: var(--ink); text-wrap: balance; }
.paper .ttl a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .16em; }
.paper .au { margin: 12px 0 0; font: 400 var(--s-text)/1.5 var(--serif); }
.paper .facts { margin: 8px 0 0; font: 400 14.5px/1.55 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }
.paper .facts span { white-space: nowrap; }

/* the sharing tools: the masked password, Show, Copy link, one quiet segmented control at the foot of the words */
.paper .pw { align-items: stretch; gap: 0; margin: auto 0 0; padding-top: 24px; }
.paper .pw code { display: inline-flex; align-items: center; height: 30px; padding: 0 10px; font: 400 12.5px/1 var(--code); letter-spacing: .04em;
  color: var(--ink); background: var(--raise); border: 1px solid var(--line); border-radius: 4px 0 0 4px; font-variant-numeric: tabular-nums; }
.paper .pw button { height: 30px; padding: 0 11px; font: 500 12px/1 var(--sans); letter-spacing: .02em; color: var(--muted); background: none;
  border: 1px solid var(--line); border-left: 0; border-radius: 0; }
.paper .pw button:last-child { border-radius: 0 4px 4px 0; }
.paper .pw button:hover { color: var(--ink); background: var(--raise); border-color: var(--line); }
.paper .pw button:focus-visible { position: relative; outline-offset: 1px; }
.paper .pw .pub { align-self: center; font: 400 12.5px/1 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

/* a phone: the page small beside the venue, the title and the authors; the facts and the sharing tools under both */
@media (max-width: 640px) {
  .top { padding-top: 32px; margin-bottom: 24px; }
  .paper { grid-template-rows: auto auto auto 1fr; column-gap: 16px; }
  .paper .about { display: contents; }
  .paper .cover { grid-row: 1 / 5; }
  .paper :is(.ven, .ttl, .au) { grid-column: 2; }
  .paper :is(.ttl, .au) { margin-top: 8px; }
  .paper :is(.facts, .pw) { grid-column: 1 / -1; }
  .paper .facts { margin-top: 16px; font-size: 14px; }
  .paper .pw { margin-top: 0; padding-top: 16px; }
  .paper .cover .at { left: 4px; right: 4px; bottom: 8px; padding: 2px 5px; font-size: 10.5px; -webkit-line-clamp: 4; }
}
