/* Handwritten notes (16 Nov 2026; take two, card look A: ios-native/INK2-SPEC.md 3b and 6).
   Ink 3 rounds 3 and 4 (17 Nov): ready-made pages' zones, task boxes, live blocks, a task's picture of its line.
   Sizes on the page use --pu (one page point at the paper's drawn width), so printed words keep their place.
   The writing always sits on paper, so dark ink reads in every theme; in dark colour modes the paper dims a little.
   Ink 3 round 2 (17 Nov, INK3-SPEC.md "Round 2"): each page has its paper and colour (--ink-tint, set from a fixed
   table in notes-ink.js); Night stays Night in every theme.
   Ink 3 round 5 (17 Nov, INK3-SPEC.md "Round 5"): each page is drawn in its own shape (aspect-ratio and --vw from
   notes-ink.js), fitted to the width; the page foot names a sized page's size. */
.note-ink-sheet {
  --ink-tint: #fff;
  --ink-paper: var(--ink-tint);
  --ink-rule: color-mix(in srgb, var(--ink-paper) 84%, #3D6A96);
  --ink-dot: color-mix(in srgb, var(--ink-paper) 62%, #3D6A96);
  --ink-margin: #F3C9D3;
  --ink-label: #C27A8E;
  --ink-text: #34414F;
  --ink-soft: #66768A;
  background: var(--ink-paper);
  color: var(--ink-text);
  min-width: 0;
}
.note-ink-sheet.tint-white { --ink-rule: #E2EAF2; }
.note-ink-sheet.tint-night {
  --ink-rule: #3A4A5A;
  --ink-dot: #4C5E70;
  --ink-margin: #8E5F6E;
  --ink-label: #C895A4;
  --ink-text: #E8EEF4;
  --ink-soft: #A9B6C3;
}
html:is([data-theme="dark"], [data-tone="dark"], [data-mode="dark"]) .note-ink-sheet {
  --ink-paper: color-mix(in srgb, var(--ink-tint) 85%, #8A9BAD);
  --ink-margin: #ECC3CD;
}
html:is([data-theme="dark"], [data-tone="dark"], [data-mode="dark"]) .note-ink-sheet.tint-white {
  --ink-paper: #ECEFF3;
  --ink-rule: #D6DEE6;
}
html:is([data-theme="dark"], [data-tone="dark"], [data-mode="dark"]) .note-ink-sheet.tint-night {
  --ink-paper: #22303D;
  --ink-margin: #8E5F6E;
}

.note-ink-paper {
  position: relative;
  width: 100%;
  container-type: inline-size;
  --pu: calc(100cqw / var(--vw, 768));   /* one page point, resolved where it is used, against this paper's width */
  background: var(--ink-paper, #fff);
  overflow: hidden;
}
.note-ink-paper > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }   /* blocks under the ink stay clickable */
.note-ink-paper .note-ink-rules { stroke: var(--ink-rule, #E2EAF2); }
.note-ink-paper .note-ink-dots { stroke: var(--ink-dot, #B8C6D4); }
.note-ink-paper .note-ink-margin { stroke: var(--ink-margin, #F3C9D3); }
.note-ink-fade-r { position: absolute; top: 0; right: 0; bottom: 0; background: linear-gradient(to right, color-mix(in srgb, var(--ink-paper) 0%, transparent), var(--ink-paper)); pointer-events: none; }
.note-ink-fade-b { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(color-mix(in srgb, var(--ink-paper) 0%, transparent), var(--ink-paper)); pointer-events: none; }

/* Cornell: "Summary" in small capitals above the summary line. */
.note-ink-summary {
  position: absolute; transform: translateY(calc(-100% - 2px));
  font-size: 9.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; line-height: 1;
  color: var(--ink-label); pointer-events: none; white-space: nowrap;
}

/* A scan as the page (round 4), and blocks on the page: framed boxes with their name, or the picture itself. */
.note-ink-bg { position: absolute; object-fit: contain; object-position: top left; display: block; }
.note-ink-block {
  position: absolute; box-sizing: border-box;
  border: 1.5px solid color-mix(in srgb, var(--ink-text) 30%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ink-paper) 70%, color-mix(in srgb, var(--ink-text) 6%, transparent));
  display: flex; align-items: flex-start; overflow: hidden; color: var(--ink-text); text-decoration: none;
}
.note-ink-block:is(.kind-photo, .kind-scan, .kind-pdf):not(.has-img) { border-style: dashed; align-items: center; justify-content: center; text-align: center; }
.note-ink-block-name {
  display: block; max-width: 100%; padding: 4px 7px;
  font-size: max(9px, calc(var(--pu) * 14)); font-weight: 600; line-height: 1.3; color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.note-ink-block.has-img { border-style: solid; }
.note-ink-block.has-img .note-ink-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.note-ink-block.has-img .note-ink-block-name { display: none; }

/* Open tasks (round 4 K): "Open tasks · project" and LIVE, then rows measured in page points (notes-ink.js BLOCK_HEAD and
   BLOCK_ROW), so the list never runs past the block's foot: fewer rows and "+N more". */
.note-ink-block.kind-tasks { flex-direction: column; align-items: stretch; }
.note-ink-block-head { display: flex; align-items: center; gap: 6px; height: calc(var(--pu) * 34); flex: none; padding-right: calc(var(--pu) * 8); min-width: 0; }
.note-ink-block-head .note-ink-block-name { flex: 1; min-width: 0; padding-top: 0; padding-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #1E7FD0; }
.note-ink-live { flex: none; font-size: max(8px, calc(var(--pu) * 10)); font-weight: 700; letter-spacing: .08em; color: #0E9F8E; border: 1px solid currentColor; border-radius: 99px; padding: 0 5px; line-height: 1.5; }
.tint-night .note-ink-block-head .note-ink-block-name { color: #8CC4F2; }
.tint-night .note-ink-live { color: #5FD3C4; }
.note-ink-block .note-ink-rows { --row: 28; padding: 0 calc(var(--pu) * 10); }
.note-ink-more { flex: none; height: calc(var(--pu) * 28); display: flex; align-items: center; padding: 0 calc(var(--pu) * 10); font-size: max(8.5px, calc(var(--pu) * 13)); color: var(--ink-soft); }

/* Live rows (the 1:1's open items and Open tasks): a box, the words on one line, the day. Done rows keep a tick and fade. */
.note-ink-rows { list-style: none; margin: 0; padding: 0; --row: 34; }
.note-ink-open-list { position: absolute; }
.note-ink-row {
  display: flex; align-items: center; gap: calc(var(--pu) * 9); height: calc(var(--pu) * var(--row)); min-width: 0;
  font-size: max(8.5px, calc(var(--pu) * 14)); line-height: 1.2; color: var(--ink-text);
}
.note-ink-row.done { opacity: .5; }
.note-ink-row.done .note-ink-row-text { text-decoration: line-through; text-decoration-thickness: 1px; }
.note-ink-row-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-ink-row-detail { flex: none; color: var(--ink-soft); font-size: .86em; }
.note-ink-none { color: var(--ink-soft); }
.note-ink-box {
  flex: none; box-sizing: border-box; width: max(11px, calc(var(--pu) * 16)); height: max(11px, calc(var(--pu) * 16));
  margin: 0; padding: 0; border: 1.6px solid var(--ink-soft); border-radius: 3px; background: var(--ink-paper);
  color: #fff; display: inline-grid; place-items: center; cursor: default; font: inherit;
}
button.note-ink-box { cursor: pointer; position: relative; }
button.note-ink-box::after { content: ""; position: absolute; inset: -9px; }   /* a bigger target than the printed box */
button.note-ink-box:hover { border-color: #1E7FD0; }
button.note-ink-box:focus-visible { outline: 2px solid #1E7FD0; outline-offset: 2px; }
.note-ink-box.done { background: #1E7FD0; border-color: #1E7FD0; }
.note-ink-box svg { width: 100%; height: 100%; display: block; }

/* Person (round 4 K): initials, name, role and what is open with them. Names wrap, never cut. */
.note-ink-block.kind-person { align-items: center; gap: calc(var(--pu) * 10); padding: calc(var(--pu) * 8) calc(var(--pu) * 12); }
.note-ink-initials {
  flex: none; display: inline-grid; place-items: center; border-radius: 50%;
  width: max(20px, calc(var(--pu) * 40)); height: max(20px, calc(var(--pu) * 40));
  background: color-mix(in srgb, #7C5CE7 16%, var(--ink-paper)); color: #5B3FC4;
  font-size: max(8.5px, calc(var(--pu) * 15)); font-weight: 700; letter-spacing: .02em;
}
.tint-night .note-ink-initials { background: #3D3566; color: #D8CCFF; }
.note-ink-person { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; min-width: 0; font-size: max(8.5px, calc(var(--pu) * 13)); line-height: 1.3; overflow-wrap: anywhere; }
.note-ink-person-name { font-weight: 600; font-size: 1.12em; color: var(--ink-text); }
.note-ink-person-role, .note-ink-person-line { color: var(--ink-soft); }
.note-ink-block.kind-person .note-ink-block-name { color: var(--ink-text); }

/* A PDF page: the website has no PDF renderer, so a framed name that opens the file at that page. */
a.note-ink-block.kind-pdf { flex-direction: column; gap: 4px; cursor: pointer; }
a.note-ink-block.kind-pdf:hover { border-color: #1E7FD0; }
.note-ink-open { font-size: max(8.5px, calc(var(--pu) * 13)); font-weight: 600; color: #1E7FD0; }
.tint-night .note-ink-open { color: #8CC4F2; }

/* On a card with writing, the page's blocks are a compact row under the paper (the writing keeps its place). */
.note-ink-blockrow { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 10px 8px; background: var(--ink-paper); border-top: 1px dashed var(--ink-rule); }
.note-ink-bchip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; min-width: 0;
  padding: 2px 8px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--ink-text) 22%, transparent);
  font-size: 11.5px; line-height: 1.35; color: var(--ink-text); overflow-wrap: anywhere;
}
.note-ink-bchip b { font-weight: 600; color: #1E7FD0; }
.note-ink-bchip.kind-tasks > span { color: #1E7FD0; font-weight: 600; }
.tint-night .note-ink-bchip b, .tint-night .note-ink-bchip.kind-tasks > span { color: #8CC4F2; }
.note-ink-bchip .note-ink-initials { width: 18px; height: 18px; font-size: 9px; }
.note-ink-bchip .note-ink-img { width: 22px; height: 22px; object-fit: cover; border-radius: 3px; display: block; }

/* Ready-made pages (round 3 G): zone lines, headings in small capitals, the ward's dashed teal line, the To-do boxes. */
.note-ink-paper .note-ink-zone { stroke: color-mix(in srgb, var(--ink-label) 55%, var(--ink-paper)); }
.note-ink-paper .note-ink-ward { stroke: #0E9F8E; }
.note-ink-paper .note-ink-printbox { fill: none; stroke: color-mix(in srgb, var(--ink-soft) 70%, var(--ink-paper)); }
.note-ink-paper .note-ink-taskbox { fill: var(--ink-paper); }
.note-ink-zh {
  position: absolute; pointer-events: none; line-height: 1.2; overflow-wrap: anywhere;
  font-size: max(8.5px, calc(var(--pu) * 11.5)); color: var(--ink-label);
}
.note-ink-zh-name { font-weight: 700; letter-spacing: .09em; }
.note-ink-zh-hint { font-weight: 500; opacity: .85; }
.note-ink-foot-count { position: absolute; transform: translateY(-50%); font-size: max(8.5px, calc(var(--pu) * 13)); color: var(--ink-soft); white-space: nowrap; }
/* The header printed in its zone: the title, then WITH (names as chips that wrap) and WHEN. */
.note-ink-hd {
  position: absolute; box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-start; gap: calc(var(--pu) * 6);
  padding: calc(var(--pu) * 18) calc(var(--pu) * 24) calc(var(--pu) * 6) calc(var(--pu) * 24);
  color: var(--ink-text); overflow-wrap: anywhere; min-width: 0;
}
.note-ink-hd-title { font-size: max(13px, calc(var(--pu) * 25)); font-weight: 650; line-height: 1.2; }
.note-ink-hd-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px calc(var(--pu) * 8); font-size: max(10px, calc(var(--pu) * 14)); line-height: 1.3; color: var(--ink-soft); min-width: 0; }
.note-ink-hd-k { font-size: .82em; font-weight: 700; letter-spacing: .09em; color: var(--ink-label); min-width: 3.4em; }
.note-ink-chip {
  display: inline-block; max-width: 100%; padding: 1px 8px; border-radius: 99px; overflow-wrap: anywhere;
  background: color-mix(in srgb, #1E7FD0 12%, var(--ink-paper)); color: var(--ink-text);
}
.tint-night .note-ink-chip { background: #34475A; }
.note-ink-head.alt { display: none; }
.note-ink-sheet.spill > .note-ink-head.alt { display: flex; }
.note-ink-sheet.spill .note-ink-hd { visibility: hidden; }

/* Open at this line: the line lights yellow (#FFE58A at 60%) for two seconds and fades (reduced motion: no fade). */
.note-ink-glow { position: absolute; left: 0; right: 0; background: rgba(255, 229, 138, .6); pointer-events: none; mix-blend-mode: multiply; transition: opacity .85s cubic-bezier(.16, .84, .3, 1); }
.tint-night .note-ink-glow { mix-blend-mode: normal; background: rgba(255, 229, 138, .35); }
.note-ink-glow.out { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .note-ink-glow { transition: none; } }

/* A ready-made page's head (round 3): kind, title, who it is with, when. Long names wrap. */
.note-ink-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px;
  padding: 8px 12px 7px; border-bottom: 1px solid var(--ink-rule);
  font-size: 12.5px; line-height: 1.35; color: var(--ink-text); overflow-wrap: anywhere;
}
.note-ink-head strong { font-weight: 600; font-size: 13.5px; min-width: 0; }
.note-ink-head-kind { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-label); }
.note-ink-head-meta { color: var(--ink-soft); min-width: 0; }

/* The card: the paper is its top, edge to edge; the title, what it became and the details sit under it. */
html .note-card.note-card-ink { padding: 0 !important; overflow: hidden; }
.note-ink-cap { padding: 11px 14px 12px; border-top: 1px solid var(--line, #e3e9f0); min-width: 0; }
.note-ink-cap > :first-child { margin-top: 0; }
.note-ink-cap h4 { overflow-wrap: anywhere; }
.note-ink-mark { color: #7C5CE7; font-weight: 500; margin-left: 4px; }

/* Starred lines: "★ line", the star in amber. Lines wrap, never cut. */
.note-ink-stars { display: grid; gap: 3px; margin: 2px 0 8px; }
.note-ink-star { display: flex; gap: 6px; align-items: baseline; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; min-width: 0; }
.note-ink-star-mark { color: #E8A317; flex: none; }
.note-ink-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* What the note became: tinted pills in the kind's colour. Names wrap, never cut. */
.note-became-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.note-became {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 3px 9px 3px 7px; border-radius: 99px;
  font-size: 12.5px; font-weight: 500; line-height: 1.35;
  color: var(--c); background: color-mix(in srgb, var(--c) 11%, transparent);
  overflow-wrap: anywhere; white-space: normal;
}
.note-became svg { width: 14px; height: 14px; flex: none; }
html:is([data-theme="dark"], [data-tone="dark"], [data-mode="dark"]) .note-became {
  color: color-mix(in srgb, var(--c) 62%, #fff); background: color-mix(in srgb, var(--c) 24%, transparent);
}

/* The note window: the whole page as written; several pages one under another, "Page 2" at each foot. */
.note-ink-page {
  border: 1px solid #dbe3ec;
  border-radius: 12px;
  max-height: 420px;
  overflow: auto;
}
.note-ink-page.many { max-height: min(72vh, 680px); background: var(--surface-soft, #f2f5f8); }
.note-ink-pages.many { display: flex; flex-direction: column; padding: 10px 10px 2px; }
.note-ink-pages.many .note-ink-sheet { border: 1px solid var(--line, #dbe3ec); border-radius: 4px; overflow: hidden; }
.note-ink-foot { font-size: 11.5px; color: var(--muted, #6b7a8a); text-align: center; padding: 4px 0 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 10px; }
/* Round 5: a sized page's size in its foot ("A4 · Portrait"), small and quiet. */
.note-ink-foot .note-ink-size { font-size: 10.5px; letter-spacing: .02em; opacity: .85; }
.note-ink-field .note-ink-stars { margin: 8px 0 0; }
.note-ink-field .note-became-row { margin: 8px 0 0; }
.note-ink-field .tiny { margin-top: 6px; }

/* Tasks (round 3 I): a task made from writing shows its line's picture, the note, page and day, and Open at this line. */
.ink-from { margin: 8px 0 2px; display: grid; gap: 5px; font-weight: 400; min-width: 0; }
.ink-from-label { font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: #7C5CE7; }
.ink-from-pic { border: 1px solid var(--line, #dbe3ec); border-radius: 6px; overflow: hidden; max-width: 560px; }
.ink-from-pic .note-ink-sheet { display: block; }
.ink-from-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.ink-from-where { font-size: 12.5px; line-height: 1.4; color: var(--muted, #5b6b7c); overflow-wrap: anywhere; min-width: 0; }
.ink-from-open { flex: none; }
.modal-body > .ink-from { margin: 0 0 14px; }
html:is([data-theme="dark"], [data-tone="dark"], [data-mode="dark"]) .ink-from-label { color: #B7A5FF; }
/* A card is a small picture: the Person block keeps the name and what is open; the role shows in the note window. */
.note-ink-paper:not(.whole) .note-ink-person-role { display: none; }
.note-ink-open-list.packed { background: var(--ink-paper); }
.note-ink-paper:not(.whole) .note-ink-person-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
