/*
  Unskipped: design code
  Convention avoided: wellness biofeedback (orbs, glow, heart rings) and cream-paper writing tools.
  Metaphor: page flags. A reader's marks are translucent film flags stuck to the paragraph,
  overhanging the fore-edge so the writer finds them from the edge.
  - Colour lives only on the flags, because the flags are the product's output.
  - The page is one sheet with real elevation on library book cloth, because the manuscript is the object being marked.
  - Flags overhang the page edge, because that is how marks are found in a real book.
  - The reader's own marks are graphite on the left, the camera's are film on the right.
  Laws: .design/brand/CHARTER.md
*/
@font-face { font-family: "Literata"; src: url("fonts/literata-latin-opsz-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: block; }
@font-face { font-family: "Literata"; src: url("fonts/literata-latin-opsz-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: block; }
@font-face { font-family: "Figtree"; src: url("fonts/figtree-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Figtree"; src: url("fonts/figtree-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: block; }
@font-face { font-family: "Figtree"; src: url("fonts/figtree-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: block; }

:root {
  /* library buckram, the cloth a rebound book wears */
  --cloth: #22352b;
  --cloth-hi: #2c4438;
  --cloth-ink: #eef2ee;      /* paper-coloured text on cloth */
  --cloth-mute: #c4d1c8;
  /* the sheet: a cool office white, not cream */
  --paper: #f7f8f5;
  --paper-2: #eceee9;
  --ink: #1a1f1c;
  --ink-2: #4a524d;
  --rule: #d9ddd6;
  --graphite: #5b5e5a;
  /* the flags: fills only, never text */
  --f-grip: #ff4f93;
  --f-smile: #ffe03a;
  --f-drift: #38b0ff;
  --f-none: rgba(255, 255, 255, 0.62);
  --serif: "Literata", Georgia, serif;
  --sans: "Figtree", "Segoe UI", system-ui, sans-serif;
  --sheet-shadow: 0 1px 1px rgba(0,0,0,.22), 0 2px 3px rgba(0,0,0,.18), 0 18px 36px -12px rgba(0,0,0,.45);
  --slip-shadow: 0 1px 1px rgba(0,0,0,.2), 0 8px 18px -8px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; color: var(--cloth-ink); font-family: var(--sans); font-size: 15px;
  background-color: var(--cloth);
  /* buckram weave: two fine crossing threads plus fibre noise */
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .06 0'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>"),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 1px, transparent 1px 3px);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--cloth-ink); outline-offset: 3px; }
.sheet :focus-visible, .slip :focus-visible { outline-color: var(--ink); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar on cloth ---------- */
/* one content width for every screen, so the wordmark and every page share a left edge */
.bar { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 8px; width: min(1180px, calc(100% - 72px)); margin: 0 auto; }
main > section { width: min(1180px, 100%); margin-left: auto !important; margin-right: auto !important; max-width: none !important; }
.wordmark { display: block; height: 34px; width: auto; color: var(--cloth-ink); }
#crumbs { display: flex; gap: 4px; font-size: 13px; color: var(--cloth-mute); }
#crumbs { gap: 18px; font-size: 14px; }
#crumbs span { display: flex; align-items: center; gap: 7px; }
#crumbs i { font-style: normal; font-family: var(--serif); width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--cloth-mute); font-size: 12px; }
#crumbs span.on { color: var(--cloth-ink); font-weight: 600; }
#crumbs span.on i { background: var(--paper); color: var(--ink); box-shadow: none; }
#crumbs span { opacity: .72; }
#crumbs span.on, #crumbs span.done { opacity: 1; }
#crumbs span.done i { background: transparent; color: var(--cloth-ink); box-shadow: inset 0 0 0 1.5px var(--cloth-ink); }

main { padding: 18px 36px 64px; }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 500; text-wrap: balance; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(34px, 4.2vw, 56px); line-height: 1.06; font-variation-settings: "opsz" 72; }
h2 { font-size: 26px; line-height: 1.15; font-variation-settings: "opsz" 48; }
p { text-wrap: pretty; }
.lede { font-family: var(--serif); font-size: 20px; line-height: 1.5; color: var(--cloth-mute); max-width: 34em; font-variation-settings: "opsz" 18; }
.sheet .lede { color: var(--ink-2); }
.small { font-size: 13px; color: var(--cloth-mute); }
.sheet .small, .slip .small { color: var(--ink-2); }

/* ---------- the sheet (one per screen) and slips ---------- */
.sheet { position: relative; background: var(--paper); color: var(--ink); box-shadow: var(--sheet-shadow); border-radius: 2px; }
.sheet::before { /* faint paper fibre */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; border-radius: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .3  0 0 0 0 .32  0 0 0 0 .3  0 0 0 .05 0'/></filter><rect width='220' height='220' filter='url(%23p)'/></svg>");
}
.slip { position: relative; background: var(--paper-2); color: var(--ink); box-shadow: var(--slip-shadow); border-radius: 2px; padding: 14px 16px; }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 3px; padding: 0 20px; min-height: 44px; font-family: var(--sans); font-weight: 600; font-size: 15px; line-height: 1.2; background: var(--ink); color: var(--paper); transition: transform .12s ease, background .12s; }
.btn:hover { background: #000; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.on-cloth .btn { background: var(--paper); color: var(--ink); }
.on-cloth .btn.quiet { background: transparent; color: var(--cloth-ink); box-shadow: inset 0 0 0 1.5px var(--cloth-mute); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
/* one title size for every app screen; the home page keeps the display size */
.consent h1, .settle .page h1, .marks-head h1, .verdict h1, .writer h1 { font-size: clamp(30px, 3.2vw, 42px); line-height: 1.1; }

/* ---------- the flag ---------- */
/* a translucent film flag: clear end stuck over the page, coloured tip overhanging the fore-edge */
.flag { position: absolute; right: -34px; width: 92px; height: 22px; border-radius: 1px 3px 3px 1px; pointer-events: auto; }
.flag::before { /* clear film end, stuck over the paper: faint tint, a crisp cut edge, a line of adhesive */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 46px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--fc) 10%, transparent), color-mix(in srgb, var(--fc) 22%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fc) 38%, transparent), inset 3px 0 0 color-mix(in srgb, var(--fc) 30%, transparent);
}
.flag::after { /* fluorescent tip, past the edge */
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 46px; background: var(--fc);
  border-radius: 0 3px 3px 0; box-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.flag.grip { --fc: var(--f-grip); }
.flag.smile { --fc: var(--f-smile); }
.flag.drift { --fc: var(--f-drift); }
.flag.none { --fc: #ffffff; }
.flag.none::after { background: var(--f-none); box-shadow: 0 1px 2px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.7); }
.flag.mini { position: relative; right: auto; display: inline-block; width: 30px; height: 12px; vertical-align: -1px; margin-right: 8px; }
.flag.mini::before { width: 14px; }
.flag.mini::after { width: 16px; }

/* ---------- home ---------- */
.home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: 16px 72px; align-items: center; max-width: 1220px; margin: 0 auto; padding-top: 2vh; }
.home h1 { color: var(--cloth-ink); font-size: clamp(38px, 4.6vw, 62px); }
.home .lede { margin: 18px 0 18px; font-size: 20px; color: var(--cloth-ink); opacity: .86; }
.home .quote { font-family: var(--serif); font-style: italic; color: var(--cloth-mute); font-size: 17px; margin: 0 0 30px; }
.btn.paper { background: var(--paper); color: var(--ink); }
.btn.paper:hover { background: #fff; }
.link { background: none; border: 0; padding: 6px 2px; color: var(--cloth-ink); font-size: 15px; text-decoration: underline; text-decoration-color: rgba(238,242,238,.4); text-underline-offset: 4px; }
.link:hover { text-decoration-color: currentColor; }
.notice { margin-top: 18px; font-size: 14px; color: var(--cloth-mute); border-left: 2px solid var(--cloth-mute); padding-left: 10px; }
.sample { margin: 0; position: relative; }
.sample { margin-right: 56px; }
.sample-page { padding: 40px 80px 34px 52px; font-family: var(--serif); font-size: 16.5px; line-height: 1.55; transform: rotate(1.4deg); transform-origin: 30% 50%; }
.sample-page p { position: relative; margin: 0 0 .75em; }
/* film end on the margin, clear of the text; fluorescent tip past the page edge */
.sample-page .flag { top: 3px; right: -128px; }
.sample-page p.got, .sample-page p.lost { box-shadow: -14px 0 0 -11px var(--graphite); }
.sample figcaption { margin-top: 22px; font-size: 13px; color: var(--cloth-mute); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.sample figcaption span { white-space: nowrap; }
.sample figcaption .swatch { margin-right: 6px; width: 14px; height: 10px; }
.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 640px; }
.path { padding: 20px 22px 22px; }
.path h2 { font-size: 22px; margin-bottom: 6px; }
.path p { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.path .flag { top: 22px; }
.foot { grid-column: 1 / -1; font-size: 13px; color: var(--cloth-mute); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-top: 12px; }
.foot a { color: var(--cloth-mute); text-decoration-color: rgba(169,188,176,.4); text-underline-offset: 3px; }
.foot a:hover { color: var(--cloth-ink); text-decoration-color: currentColor; }

/* ---------- consent ---------- */
.consent { max-width: 1120px; margin: 0 auto; padding: 40px 48px; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 48px; }
.consent h1 { font-size: 36px; margin-bottom: 8px; }
.consent .lede { font-size: 18px; margin: 0; }
.consent dl { display: grid; grid-template-columns: 140px 1fr; gap: 12px 20px; margin: 22px 0 0; }
.consent dt { font-weight: 600; font-size: 14px; padding-top: 1px; }
.consent dd { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.consent-act { border-left: 1px solid var(--rule); padding-left: 36px; display: flex; flex-direction: column; gap: 16px; align-self: stretch; justify-content: center; }
.agree { display: flex; gap: 12px; align-items: flex-start; font-family: var(--serif); font-size: 19px; line-height: 1.35; cursor: pointer; }
.agree input { margin-top: 3px; width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.field { display: grid; gap: 6px; font-size: 14px; }
select, input[type=text] { font: inherit; padding: 9px 10px; border: 1.5px solid var(--rule); background: #fff; border-radius: 3px; color: var(--ink); min-width: 200px; }
.side-art img { width: 100%; display: block; filter: drop-shadow(0 12px 18px rgba(0,0,0,.35)); }
.side-art p { color: var(--cloth-mute); font-size: 14px; line-height: 1.5; }

/* ---------- reading ---------- */
.reading { display: grid; grid-template-columns: minmax(0, 760px) 280px; gap: 56px; justify-content: start; }
.page { padding: 64px 76px 46vh; font-family: var(--serif); font-size: 21px; line-height: 1.65; font-variation-settings: "opsz" 14; }
.page h1 { font-size: 40px; margin-bottom: 6px; }
.page .byline { font-style: italic; color: var(--ink-2); font-size: 15px; margin-bottom: 34px; }
.page p { margin: 0 0 1em; position: relative; }
.page p.focus::before { /* a strip of clear film laid over the line being read */
  content: ""; position: absolute; left: -18px; right: -18px; top: -4px; bottom: -4px; background: rgba(26,31,28,.045); border-radius: 2px; pointer-events: none;
}
.page .flag.live { top: 4px; right: -110px; animation: live-in .25s ease-out; }
@keyframes live-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
/* the reading line: two pencil ticks in the margins, never a rule through the text */
#readline { position: fixed; top: 38vh; height: 0; pointer-events: none; z-index: 4; }
#readline::before, #readline::after { content: ""; position: absolute; top: -1px; width: 26px; height: 2px; background: var(--cloth-mute); border-radius: 1px; }
#readline::before { left: -36px; } #readline::after { right: -36px; }
.page h1 + p, .page h1 + .byline + p { margin-top: 18px; }
.settle-state { font-size: 15px !important; }
.rail { position: sticky; top: 24px; align-self: start; display: grid; gap: 14px; color: var(--cloth-ink); }
.rail canvas { width: 100%; border-radius: 2px; background: #121a16; display: block; transform: scaleX(-1); box-shadow: 0 0 0 1px rgba(238,242,238,.18); }
.readout { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; align-items: baseline; font-size: 14px; padding-top: 12px; border-top: 1px solid rgba(238,242,238,.16); }
.readout .k { color: var(--cloth-mute); }
.readout b { font-family: var(--serif); font-size: 24px; font-weight: 500; font-variant-numeric: lining-nums tabular-nums; text-align: right; }
.readout small { font-family: var(--sans); font-size: 13px; color: var(--cloth-mute); font-weight: 400; }
.rail-note { margin: 0; font-size: 13px; color: var(--cloth-mute); }
.state { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--cloth-mute); }
.state .ok { color: var(--cloth-ink); font-weight: 600; } .state .warn { color: var(--cloth-ink); font-weight: 600; text-decoration: underline wavy var(--cloth-mute) 1px; text-underline-offset: 4px; }

/* ---------- marks (the reader's pencil) ---------- */
.marks-wrap { max-width: 820px; margin: 0 auto; }
.marks-wrap .markable, .marks-wrap .dock, .marks-head, .writer .sheet, .writer .lede { max-width: 860px; }
.marks-head { color: var(--cloth-ink); margin-bottom: 20px; }
.marks-head .lede { color: var(--cloth-mute); }
.markable { padding: 48px 72px; font-family: var(--serif); font-size: 18px; line-height: 1.6; }
.markable p { position: relative; cursor: pointer; padding: 6px 10px; margin: 0 -10px .7em; border-radius: 2px; }
.markable p:hover { background: rgba(26,31,28,.04); }
.markable p.got, .markable p.lost, .annot .para.got, .annot .para.lost { box-shadow: inset 3px 0 0 var(--graphite); }
.markable p.got::after, .markable p.lost::after, .annot .para.got::after, .annot .para.lost::after {
  position: absolute; left: -64px; top: 6px; width: 50px; text-align: right; font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--graphite);
}
.markable p.got::after, .annot .para.got::after { content: "got me"; }
.markable p.lost::after, .annot .para.lost::after { content: "lost me"; }
.markable p.lost, .annot .para.lost { box-shadow: inset 3px 0 0 var(--graphite), inset 6px 0 0 var(--paper), inset 8px 0 0 var(--graphite); }
.dock { position: sticky; bottom: 0; display: flex; gap: 16px; align-items: center; padding: 16px 0 18px; background: var(--cloth); box-shadow: 0 -12px 18px -6px var(--cloth); z-index: 3; }
.dock .small { color: var(--cloth-mute); }

/* ---------- review ---------- */
.review { display: grid; grid-template-columns: minmax(0, 780px) 330px; gap: 64px; justify-content: start; }
.verdict { grid-column: 1 / -1; color: var(--cloth-ink); max-width: 980px; }
.verdict h1 { font-size: clamp(30px, 3.4vw, 46px); }
.verdict h1 .n { font-variant-numeric: lining-nums; }
.verdict .base { font-family: var(--serif); font-size: 20px; color: var(--cloth-mute); margin: 10px 0 0; }
.annot { padding: 56px 70px 64px; font-family: var(--serif); }
.annot .para { position: relative; font-size: 18px; line-height: 1.6; padding: 4px 0; margin-bottom: .6em; }
.annot .para .flag { top: 6px; right: -116px; cursor: pointer; border: 0; padding: 0; background: none; }
.annot .para .flag.cur::after { box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 0 0 2px var(--cloth-ink); }
.annot .para .flag[aria-pressed=false] { opacity: .28; }
.annot .para.sel::before { content: ""; position: absolute; left: -16px; right: -16px; top: -2px; bottom: -2px; background: rgba(26,31,28,.05); border-radius: 2px; }
.notes { position: sticky; top: 24px; align-self: start; display: grid; gap: 14px; }
.legend { display: grid; gap: 9px; font-size: 14px; color: var(--cloth-ink); }
.swatch { display: inline-block; width: 18px; height: 12px; border-radius: 0 2px 2px 0; margin-right: 10px; vertical-align: -1px; }
.swatch.grip { background: var(--f-grip); } .swatch.smile { background: var(--f-smile); } .swatch.drift { background: var(--f-drift); }
.swatch.none { background: var(--f-none); box-shadow: inset 0 0 0 1px #fff; }
.swatch.pencil { width: 3px; margin: 0 25px 0 0; height: 14px; background: var(--cloth-mute); border-radius: 0; }
/* the chapter seen from its fore-edge: one slot per paragraph */
.edge { display: flex; align-items: flex-end; height: 62px; margin-top: 28px; padding-top: 22px; width: 100%; max-width: 1060px; }
.verdict { max-width: none !important; }
.edge .slot { position: relative; flex: 1 1 0; min-width: 6px; height: 30px; background:
    repeating-linear-gradient(180deg, #f7f8f5 0 2px, #e6e8e3 2px 3px); /* the stacked leaves of a fore-edge */
  box-shadow: inset -1px 0 0 rgba(26,31,28,.18); }
.edge .slot:first-child { border-radius: 2px 0 0 2px; } .edge .slot:last-child { border-radius: 0 2px 2px 0; box-shadow: none; }
.edge .slot:hover { filter: brightness(1.06); }
.edge .tip { position: absolute; left: 50%; width: 14px; margin-left: -7px; top: -19px; height: 22px; border-radius: 2px 2px 0 0; background: var(--fc); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.edge .tip.grip { --fc: var(--f-grip); } .edge .tip.smile { --fc: var(--f-smile); } .edge .tip.drift { --fc: var(--f-drift); }
.edge .tip.none { --fc: var(--f-none); box-shadow: inset 0 0 0 1px #fff; }
.edge .slot.got::after, .edge .slot.lost::after { content: ""; position: absolute; left: 50%; bottom: -10px; width: 2px; height: 7px; background: var(--cloth-mute); }
.edge .slot.lost::after { box-shadow: 4px 0 0 var(--cloth-mute); margin-left: -2px; }
.edge-key { font-size: 13px; color: var(--cloth-mute); margin: 16px 0 0; }
.note-slip h2 { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.note-slip p { margin: 0 0 10px; font-size: 15px; line-height: 1.45; }
.note-slip .ev { font-size: 13px; color: var(--ink-2); }
.send { display: grid; gap: 10px; }
.send label { font-size: 13px; color: var(--cloth-mute); display: flex; gap: 8px; align-items: flex-start; }

@keyframes flag-out { from { transform: translateX(-60px); } to { transform: none; } }
.annot.reveal .flag { animation: flag-out .5s cubic-bezier(.2,.8,.25,1) both; animation-delay: calc(var(--k) * 45ms); }
@media (prefers-reduced-motion: reduce) { .annot.reveal .flag { animation: none; } .btn { transition: none; } }

/* ---------- writer ---------- */
.writer { max-width: 860px; margin: 0 auto; }
.writer .sheet { padding: 44px 52px; margin-top: 22px; }
table.files { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0 18px; }
table.files td { padding: 10px 4px; border-bottom: 1px solid var(--rule); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--paper); color: var(--ink); padding: 12px 18px; border-radius: 3px; font-size: 14px; z-index: 9; box-shadow: var(--slip-shadow); max-width: 80vw; }
.error { color: var(--ink); font-weight: 600; }

@media (max-width: 980px) {
  .home, .consent, .reading, .review { grid-template-columns: 1fr; }
  .consent-act { border-left: 0; padding-left: 0; }
  .rail, .notes { position: static; }
  .settle .rail { order: -1; } /* on a phone the reader needs to see themselves first */
  .page, .annot, .markable, .consent { padding-left: 28px; padding-right: 48px; }
  .paths { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  main, .bar { padding-left: 16px; padding-right: 16px; }
  .bar { width: 100%; }
  .sample { margin-right: 46px; }
  .sample-page { padding: 26px 60px 24px 22px; font-size: 15px; }
  .sample-page .flag { right: -106px; }
  .writer .sheet { padding: 28px 20px; }
  .writer .row .btn { width: 100%; }
  .dock { flex-direction: column; align-items: stretch; gap: 8px; box-shadow: none; border-top: 1px solid rgba(238,242,238,.16); }
  .consent dl { grid-template-columns: 1fr; gap: 2px 0; }
  .consent dd { margin-bottom: 10px; }
  .annot { padding-right: 44px; }
  .annot .para .flag { right: -60px; width: 70px; }
  .annot .para .flag::before { width: 30px; }
  .annot .para .flag::after { width: 40px; }
  .markable p.got::after, .markable p.lost::after, .annot .para.got::after, .annot .para.lost::after { display: none; }
  #crumbs { display: none; }
}

/* ---------- round 4 fixes ---------- */
/* reading line: two short ink ticks inside the page margin */
#readline::before, #readline::after { background: rgba(26,31,28,.38); width: 20px; }
#readline::before { left: 22px; } #readline::after { right: 22px; }
/* reader's marks: legible labels */
.markable p.got::after, .markable p.lost::after, .annot .para.got::after, .annot .para.lost::after { font-size: 13px; color: var(--ink-2); }
/* disabled primary keeps its place and weight */
.btn:disabled { opacity: .5; }
/* a native select that matches the buttons */
select { appearance: none; -webkit-appearance: none; padding-right: 34px; border: 1.5px solid var(--ink-2); background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' fill='none' stroke='%231a1f1c' stroke-width='1.6'/></svg>") no-repeat right 12px center; }
input[type=text] { border-color: var(--ink-2); }
.agree { font-family: var(--sans); font-size: 16px; font-weight: 600; }
/* review: replay notice on top, readable line length, visible pencil ticks */
.replay-note { font-size: 14px; color: var(--cloth-mute); margin: 0 0 12px; }
.verdict .base { max-width: 62ch; }
.edge .slot.got::after, .edge .slot.lost::after { width: 2px; height: 10px; bottom: -13px; background: var(--cloth-ink); }
.edge .slot.lost::after { box-shadow: 4px 0 0 var(--cloth-ink); }
/* stop is a quiet text action, apart from finishing */
.rail .link { margin-left: 12px; }
.writer .back { margin: 0 0 14px; padding-left: 0; }
@media (max-width: 560px) {
  #crumbs { display: flex !important; }
  #crumbs span:not(.on) { display: none; }
  .markable p.got::after, .markable p.lost::after { display: block !important; position: static; width: auto; text-align: left; margin-top: 4px; }
  .rail .link { margin-left: 4px; }
}
@media (max-width: 560px) { #readline::before { left: 6px; width: 14px; } #readline::after { right: 8px; width: 14px; } }

/* ---------- round 5: layouts on one grid ---------- */
/* every two-column screen ends at the header's right edge */
.reading { grid-template-columns: minmax(0, 760px) 300px; justify-content: space-between; }
.review { grid-template-columns: minmax(0, 780px) 330px; justify-content: space-between; row-gap: 36px; }
.consent, .settle, .writer, .marks-wrap { margin-top: 2vh; }
.consent { max-width: none; }

/* settle: the camera is the hero */
.settle { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 48px; align-items: start; }
.settle-cam { display: grid; gap: 14px; color: var(--cloth-ink); }
.cam-frame { position: relative; aspect-ratio: 16 / 9; background: #121a16; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px rgba(238,242,238,.18), var(--sheet-shadow); }
.cam-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-wait { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; color: var(--cloth-mute); }
.cam-guide { position: absolute; inset: 6% 0 0; width: 100%; height: 94%; fill: none; stroke: rgba(238,242,238,.42); stroke-width: .6; stroke-dasharray: 2 1.6; pointer-events: none; }
.settle-cam .readout { grid-template-columns: repeat(3, auto auto); justify-content: start; column-gap: 12px; }
.settle-cam .readout .k:not(:first-child) { margin-left: 30px; }
.settle-cam .readout b { text-align: left; }
.settle-card { padding: 40px 40px 34px; }
.settle-card h1 { font-size: clamp(28px, 2.6vw, 36px) !important; }
.settle-card > p { font-family: var(--serif); font-size: 17px; line-height: 1.6; color: var(--ink-2); margin: 16px 0; }
.settle-card .settle-state { font-family: var(--sans); font-size: 15px; color: var(--ink); font-weight: 600; margin: 22px 0 16px; }
.link-ink { background: none; border: 0; padding: 6px 2px; color: var(--ink); font-size: 15px; text-decoration: underline; text-decoration-color: rgba(26,31,28,.35); text-underline-offset: 4px; }
.link-ink:hover { text-decoration-color: currentColor; }

/* marks: page and a side panel, like the read screen */
.marks-wrap { display: grid; grid-template-columns: minmax(0, 760px) 300px; justify-content: space-between; column-gap: 56px; }
.marks-wrap .markable, .marks-head { max-width: none; }
.marks-head { grid-column: 1 / -1; max-width: 62ch; }
.marks-side { position: sticky; top: 24px; align-self: start; display: grid; gap: 14px; color: var(--cloth-ink); }
.marks-side .count { font-family: var(--serif); font-size: 24px; margin: 0; font-variant-numeric: lining-nums; }
.marks-side .small { margin: 0; }
.mark-key { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; color: var(--cloth-mute); align-items: center; }
.mark-key .mk { font-weight: 600; color: var(--cloth-ink); padding-left: 10px; box-shadow: inset 3px 0 0 var(--cloth-mute); }
.mark-key .mk.lost { box-shadow: inset 3px 0 0 var(--cloth-mute), inset 6px 0 0 var(--cloth), inset 8px 0 0 var(--cloth-mute); padding-left: 14px; }
@media (hover: hover) and (min-width: 561px) {
  .markable p:not(.got):not(.lost):hover::after { content: "got me?"; position: absolute; left: -64px; top: 6px; width: 50px; text-align: right; font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--graphite); opacity: .45; }
}

/* review: the edge strip spans the page, its key right under it */
.edge { max-width: none; }
.legend-row { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; font-size: 14px; }

@media (max-width: 980px) {
  .settle, .marks-wrap, .reading, .review { grid-template-columns: 1fr; }
  .marks-side { position: sticky; top: auto; bottom: 0; z-index: 3; background: var(--cloth); padding: 12px 0 14px; border-top: 1px solid rgba(238,242,238,.16); grid-template-columns: 1fr auto; align-items: center; }
  .marks-side .mark-key, .marks-side .small { display: none; }
  .marks-side .count { font-size: 17px; }
}
@media (max-width: 560px) {
  .settle-card { padding: 26px 22px; }
  .settle-cam .readout .k:not(:first-child) { margin-left: 16px; }
  .marks-side { grid-template-columns: 1fr; }
}

/* ---------- round 6 ---------- */
/* a link styled as a button is laid out like one */
.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
/* disabled: an empty outline that reads as "not yet", never a muddy grey fill */
.btn:disabled, .btn:disabled:hover { opacity: 1; background: transparent; color: #8a918c; box-shadow: inset 0 0 0 1.5px var(--rule); }
.on-cloth .btn:disabled { color: rgba(238,242,238,.5); box-shadow: inset 0 0 0 1.5px rgba(238,242,238,.22); }
.small { font-size: 14px; }
/* marks: choosing is stronger than hovering */
.markable { padding-top: 34px; }
.markable p:hover { background: rgba(26,31,28,.025); }
.markable p.got, .markable p.lost { background: rgba(26,31,28,.04); box-shadow: inset 4px 0 0 var(--ink); }
.markable p.lost { box-shadow: inset 4px 0 0 var(--ink), inset 7px 0 0 var(--paper), inset 10px 0 0 var(--ink); }
.markable p.got::after, .markable p.lost::after { color: var(--ink); font-weight: 700; }
.markable p.lost::after { text-decoration: line-through; text-decoration-thickness: 1.5px; }
/* review: readable ticks, a plain strip, the note wears its flag colour */
.edge .slot { background: var(--paper); }
.edge .slot.got::after, .edge .slot.lost::after { width: 3px; height: 10px; bottom: -14px; }
.edge .slot.lost::after { box-shadow: 5px 0 0 var(--cloth-ink); margin-left: -3px; }
.note-slip h2 .swatch { width: 14px; height: 10px; margin-right: 8px; }
/* settle: the waiting message sits under the outline, not across it */
.cam-wait { place-items: end center; padding-bottom: 7%; }
/* read: stop well apart from finishing */
.rail .link { margin-left: 40px; }
/* writer: the table's first column lines up with its heading */
table.files td:first-child { padding-left: 0; }
/* home: breathing room under the footer */
.foot { padding-bottom: 24px; }
@media (max-width: 560px) {
  #crumbs span.on i { display: none; }
  #crumbs span.on::before { content: attr(data-step) " · "; color: var(--cloth-mute); font-weight: 400; }
  #readline { display: none; }
  .rail .link { margin-left: 24px; }
  .markable p.got, .markable p.lost { padding-top: 26px; }
  .markable p.got::after, .markable p.lost::after { position: absolute !important; top: 6px; left: 14px; margin: 0; }
  .legend-row { display: grid; grid-template-columns: 1fr; gap: 6px; }
  .sample { margin-right: 56px; }
}
@media (max-width: 980px) { .marks-side { box-shadow: 0 -10px 16px -8px rgba(0,0,0,.45); } }

/* ---------- round 7: the paper carries into the working screens ---------- */
.btn:disabled, .btn:disabled:hover { background: #d3d8d3; color: var(--ink-2); box-shadow: none; }
.on-cloth .btn:disabled { background: rgba(238,242,238,.22); color: rgba(238,242,238,.6); box-shadow: none; }
/* consent: explanations in the book serif; one hint right under the buttons */
.consent dd { font-family: var(--serif); font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.consent dt { font-size: 13px; padding-top: 3px; }
.agree input { margin-left: 0; }
#why { margin: -4px 0 0; }
/* review: the note is a paper slip with its flag's colour along its edge */
.note-slip { background: var(--paper); box-shadow: var(--slip-shadow), inset 5px 0 0 var(--fc, transparent); padding-left: 20px; }
.edge-cap { margin: 22px 0 0; }
.edge { margin-top: 6px; }
.swatch.pencil { width: 14px; height: 10px; margin: 0 10px 0 0; background: linear-gradient(90deg, var(--cloth-mute) 0 3px, transparent 3px); }
.legend-row { flex-wrap: nowrap; }
@media (max-width: 1100px) { .legend-row { flex-wrap: wrap; } }
/* marks: pencil strokes, a straight one for got me and a wavy one for lost me, serif italic labels */
.markable p.got { box-shadow: inset 3px 0 0 var(--graphite); }
.markable p.lost { box-shadow: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='12'><path d='M3 0 Q6 3 3 6 Q0 9 3 12' fill='none' stroke='%235b5e5a' stroke-width='1.8'/></svg>"); background-repeat: repeat-y; background-position: 0 0; background-color: rgba(26,31,28,.04); }
.markable p.got::after, .markable p.lost::after { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 15px; color: var(--ink); text-decoration: none; }
/* read: one small pointer in the left margin */
#readline::after { display: none; }
#readline::before { left: 34px; width: 0; height: 0; top: -6px; background: none; border-radius: 0; border-left: 8px solid rgba(26,31,28,.45); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
/* writer: controls on the left, what the writer gets on the right */
.writer { display: grid; grid-template-columns: minmax(0, 1fr) 400px; column-gap: 64px; align-items: start; }
.writer > .back, .writer > h1, .writer > .lede { grid-column: 1 / -1; }
.writer .sheet { max-width: none; }
.word-preview { margin: 22px 0 0; position: relative; }
.wp-page { padding: 30px 120px 26px 30px; font-family: var(--serif); font-size: 15px; line-height: 1.55; transform: rotate(-1deg); }
.wp-page p { margin: 0 0 .7em; }
.wp-page mark { background: rgba(26,31,28,.09); color: inherit; padding: 1px 0; }
.wp-comment { position: absolute; right: -14px; top: 74px; width: 168px; background: #fff; color: var(--ink); border: 1px solid #c9cdc8; border-left: 3px solid var(--f-grip); border-radius: 3px; padding: 9px 11px; font-size: 13px; line-height: 1.4; box-shadow: var(--slip-shadow); display: grid; gap: 3px; transform: rotate(-1deg); }
.wp-comment b { font-size: 12px; }
.word-preview figcaption { margin-top: 18px; font-size: 14px; color: var(--cloth-mute); }
@media (max-width: 980px) { .writer { grid-template-columns: 1fr; } .word-preview { max-width: 460px; } }
@media (max-width: 560px) {
  #readline { display: none; }
  .wp-page { padding-right: 90px; }
  .wp-comment { width: 130px; right: -4px; }
}
.writer > .back { justify-self: start; }
.wp-page { padding-right: 156px; }
.wp-comment { width: 150px; right: -10px; }
@media (max-width: 560px) { .wp-page { padding-right: 128px; } .wp-comment { width: 120px; right: -4px; font-size: 12px; } }
.writer .wp-page { padding: 30px 156px 26px 30px; margin-top: 0; }
@media (max-width: 560px) { .writer .wp-page { padding: 24px 128px 20px 20px; } }
.wp-comment { top: 150px; }
@media (max-width: 560px) { .wp-comment { top: 120px; } }

/* ---------- round 8: defects from the last critic pass ---------- */
.legend-row { margin-top: 26px; }
/* one page width and one side column on read, marks and review */
@media (min-width: 981px) { .review { grid-template-columns: minmax(0, 760px) 300px; } }
.notes { position: relative; top: auto; }
/* phones and narrow windows: one column, and the selected note is a sheet pinned to the bottom of
   the screen, so tapping a flag shows its note without scrolling past the whole chapter */
@media (max-width: 980px) {
  .review { grid-template-columns: minmax(0, 1fr); }
  .review #note { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 5; max-height: 38vh; overflow: auto; margin: 0; }
  .review .annot { padding-bottom: 40vh; padding-right: 76px; }
  .annot .para .flag { right: -64px; width: 70px; }
  .annot .para .flag::before { width: 30px; }
  .annot .para .flag::after { width: 40px; }
}
.note-slip { transition: margin-top .25s ease; }
@media (prefers-reduced-motion: reduce) { .note-slip { transition: none; } }
/* marks: labels clear of the card edge */
.markable { padding-left: 96px; }
.markable p.got::after, .markable p.lost::after, .markable p:not(.got):not(.lost):hover::after { left: -82px; width: 62px; }
.rail .link { margin-left: 16px; }
/* writer: the example comment stays inside its page */
.wp-comment { right: 14px; }
@media (max-width: 980px) {
  /* read on a narrow screen: readings and finishing stay in view as a bottom bar */
  .reading:not(.settle) .rail { position: sticky; bottom: 0; top: auto; z-index: 3; background: var(--cloth); padding: 10px 0 12px; border-top: 1px solid rgba(238,242,238,.16); box-shadow: 0 -10px 16px -8px rgba(0,0,0,.45); grid-template-columns: 1fr; gap: 8px; }
  .reading:not(.settle) .rail canvas, .reading:not(.settle) .rail .rail-note { display: none; }
  .reading:not(.settle) .rail .readout { grid-template-columns: repeat(3, auto auto); justify-content: start; column-gap: 10px; padding-top: 0; border-top: 0; }
  .reading:not(.settle) .rail .readout b { font-size: 17px; text-align: left; }
  .reading:not(.settle) .rail .readout .k:not(:first-child) { margin-left: 14px; }
}
@media (max-width: 560px) {
  .markable { padding-left: 22px; }
  .wp-comment { right: 10px; }
}

/* ---------- guided reading ---------- */
.page p[data-i] { transition: opacity .3s ease, filter .3s ease; cursor: pointer; }
.page p.ahead { opacity: .16; filter: blur(1.4px); }
.page p.past { opacity: .5; }
.page .read-hint { font-family: var(--sans); font-size: 14px; color: var(--ink-2); margin: 0 0 30px; line-height: 1.5; }
.read-hint kbd { font-family: var(--sans); font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--rule), 0 1px 0 var(--rule); background: #fff; }
@media (prefers-reduced-motion: reduce) { .page p[data-i] { transition: none; } }
