/* The paper. One stylesheet drawn by the blank sheet, the online fill-in page,
   a saved entry's print view, the built PDFs and Part II of the book. It is
   always "paper" (white, dark ink) whatever the site's light/dark theme is.
   Page rules (@page) live in the pages that print, not here. */

.fm-paper, .fm-sheet {
  --fm-ink:#1A1917; --fm-soft:#5C564C; --fm-mute:#8A8378;
  --fm-rule:#B9B2A4; --fm-hair:#DAD4C8; --fm-cream:#F4F1EA; --fm-accent:#B4532A;
  --fm-lh:25px;
  color-scheme: light;
}

/* ---- the sheet of paper on screen ---- */
.fm-paper {
  width:8.5in; max-width:none; margin:0 auto; padding:.6in .6in .5in;
  background:#fff; color:#1A1917; box-sizing:border-box;
  box-shadow:0 1px 3px rgba(0,0,0,.22), 0 10px 30px rgba(0,0,0,.16);
}

.fm-sheet, .fm-sheet *, .fm-sheet *::before, .fm-sheet *::after { box-sizing:border-box; }
.fm-sheet {
  font-family:'FM Sans','IBM Plex Sans',system-ui,-apple-system,'Segoe UI',Arial,sans-serif;
  font-size:10pt; line-height:1.35; color:var(--fm-ink); text-align:left;
  -webkit-print-color-adjust:exact; print-color-adjust:exact;
}
.fm-sheet h1, .fm-sheet h2, .fm-sheet p { margin:0; font-family:inherit; text-transform:none; letter-spacing:normal; }

/* ---- header ---- */
.fm-head { padding-bottom:10px; border-bottom:2px solid var(--fm-ink); }
.fm-kicker { font:600 7.5pt/1 'FM Mono','IBM Plex Mono',ui-monospace,Consolas,monospace; letter-spacing:.12em; text-transform:uppercase; color:var(--fm-accent); }
.fm-sheet .fm-title { font-size:22pt; font-weight:600; line-height:1.12; letter-spacing:-.015em; margin-top:8px; color:var(--fm-ink); }
.fm-sheet .fm-purpose { font-size:10pt; font-style:italic; color:var(--fm-soft); margin-top:6px; max-width:88ch; }

.fm-sample { margin-top:10px; padding:6px 10px; background:#FFF4D6; border:1px solid #E5CF8F; color:#5A4A12; font-size:8.5pt; }
.fm-banner { margin-top:10px; padding:8px 12px; background:#FBEAE3; border:1px solid #E3B3A0; color:#7A2E12; font-size:9pt; line-height:1.4; }

/* ---- blocks ---- */
.fm-block { margin-top:12px; }
.fm-sec { break-inside:auto; }
.fm-field { break-inside:avoid; }
.fm-sheet .fm-sec-title, .fm-sheet .fm-label { break-after:avoid; }
.fm-strip { margin-top:12px; padding:9px 10px 11px; background:var(--fm-cream); border-top:1.5px solid var(--fm-ink); border-bottom:1px solid var(--fm-hair); break-inside:avoid; }
.fm-sheet .fm-sec-title {
  font:600 8pt/1.2 'FM Mono','IBM Plex Mono',ui-monospace,Consolas,monospace; letter-spacing:.09em; text-transform:uppercase;
  color:var(--fm-accent); margin:0 0 7px; padding-bottom:3px; border-bottom:1px solid var(--fm-hair);
}
.fm-pagebreak { break-after:page; height:0; }

.fm-grid { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:9px 14px; align-items:end; }
.fm-w1{grid-column:span 1}.fm-w2{grid-column:span 2}.fm-w3{grid-column:span 3}
.fm-w4{grid-column:span 4}.fm-w5{grid-column:span 5}.fm-w6{grid-column:span 6}
.fm-field { min-width:0; }
.fm-t-long, .fm-t-checks { align-self:start; }

.fm-label {
  display:block; font:500 7pt/1.25 'FM Mono','IBM Plex Mono',ui-monospace,Consolas,monospace;
  letter-spacing:.055em; text-transform:uppercase; color:var(--fm-soft); margin-bottom:3px;
}

/* ---- handwriting lines ---- */
.fm-line { min-height:24px; border-bottom:1px solid var(--fm-rule); display:flex; align-items:flex-end; }
/* Ruled lines are real elements (not a gradient) so they print the same everywhere. */
.fm-lines { position:relative; min-height:calc(var(--n,3) * var(--fm-lh)); line-height:var(--fm-lh); }
.fm-lines > i, .fm-rules > i { display:block; height:var(--fm-lh); border-bottom:1px solid var(--fm-rule); }
.fm-rules { position:absolute; left:0; right:0; top:0; }
.fm-val { font-size:10pt; padding:0 2px; white-space:pre-wrap; overflow-wrap:anywhere; }
.fm-lines .fm-val { position:relative; display:block; line-height:var(--fm-lh); padding:0; }
.fm-datehint:empty::after { content:'MM / DD / YYYY'; font:400 6.5pt 'FM Mono','IBM Plex Mono',monospace; letter-spacing:.06em; color:#CFC8BB; padding:0 2px 3px; }

/* ---- choices ---- */
.fm-opts { display:inline-flex; flex-wrap:wrap; gap:4px 16px; align-items:center; }
.fm-inline .fm-opts { min-height:24px; padding-bottom:2px; }
.fm-checks { display:grid; grid-template-columns:repeat(var(--cols,2),minmax(0,1fr)); gap:5px 18px; }
.fm-opt { display:inline-flex; align-items:flex-start; gap:6px; font-size:9.5pt; line-height:1.25; position:relative; }
.fm-opts .fm-opt { white-space:nowrap; align-items:center; }
.fm-box { flex:none; width:11px; height:11px; margin-top:1px; border:1.3px solid var(--fm-ink); background:#fff; display:inline-block; }
.fm-opts .fm-box { margin-top:0; }
.fm-box.rd { border-radius:50%; }
.fm-box.on { background:var(--fm-ink); box-shadow:inset 0 0 0 2px #fff; }
.fm-opt input { position:absolute; opacity:0; width:0; height:0; }
.fm-opt input:checked + .fm-box { background:var(--fm-ink); box-shadow:inset 0 0 0 2px #fff; }
.fm-opt input:focus-visible + .fm-box { outline:2px solid var(--fm-accent); outline-offset:2px; }

/* ---- tables ---- */
.fm-tablewrap { margin-top:2px; }
.fm-table { width:100%; border-collapse:collapse; table-layout:fixed; }
.fm-table th {
  font:500 6.8pt/1.2 'FM Mono','IBM Plex Mono',ui-monospace,Consolas,monospace; letter-spacing:.05em; text-transform:uppercase;
  color:var(--fm-soft); background:var(--fm-cream); text-align:left; padding:5px 6px; border:1px solid var(--fm-rule);
}
.fm-table td { border:1px solid var(--fm-rule); padding:3px 6px; vertical-align:top; height:26px; font-size:9.5pt; overflow-wrap:anywhere; }
.fm-table tr { break-inside:avoid; }
.fm-table .fm-static { background:#FAF8F3; color:var(--fm-soft); font-size:9pt; line-height:1.3; padding-top:5px; }
.fm-table .fm-pre { display:block; padding-top:3px; font-size:9.5pt; }
.fm-table .fm-line { border-bottom:0; min-height:20px; }
.fm-table .fm-lines { --fm-lh:19px; }
.fm-table .fm-lines .fm-val { padding:0; }
.fm-table .fm-val { padding:2px 0 0; display:block; }
.fm-table .fm-opts { padding-top:4px; }
.fm-table .fm-datehint:empty::after { content:''; }
.fm-table .fm-checks { padding-top:3px; }

.fm-note { margin-top:12px; padding:6px 10px; background:var(--fm-cream); border-left:3px solid var(--fm-accent); font-size:9pt; font-style:italic; color:var(--fm-soft); break-inside:avoid; }
.fm-sheet p.fm-redact { margin-top:14px; padding-top:6px; border-top:1px dashed var(--fm-rule); font:500 7pt 'FM Mono','IBM Plex Mono',ui-monospace,monospace; letter-spacing:.06em; text-transform:uppercase; color:var(--fm-accent); }
.fm-foot { margin-top:18px; padding-top:6px; border-top:1px solid var(--fm-hair); font:400 6.8pt 'FM Mono','IBM Plex Mono',ui-monospace,monospace; letter-spacing:.04em; color:var(--fm-mute); }

/* ---- online fill-in (edit mode) ---- */
.fm-in {
  display:block; width:100%; margin:0; font:inherit; color:inherit; background:transparent; border:0;
  border-bottom:1px solid var(--fm-rule); border-radius:0; padding:2px 2px 3px; min-height:24px; outline:0; box-shadow:none;
}
.fm-in:hover { background:rgba(180,83,42,.035); }
.fm-in:focus { border-bottom-color:var(--fm-accent); background:rgba(180,83,42,.07); }
.fm-ta {
  resize:vertical; padding:0 2px; line-height:var(--fm-lh); border-bottom:0; white-space:pre-wrap; overflow:auto;
  background:repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--fm-lh) - 1px), var(--fm-rule) calc(var(--fm-lh) - 1px), var(--fm-rule) var(--fm-lh));
  background-attachment:local;
}
.fm-ta:hover, .fm-ta:focus {
  background:repeating-linear-gradient(to bottom, rgba(180,83,42,.05) 0, rgba(180,83,42,.05) calc(var(--fm-lh) - 1px), var(--fm-rule) calc(var(--fm-lh) - 1px), var(--fm-rule) var(--fm-lh));
  background-attachment:local;
}
.fm-table .fm-in { border-bottom:0; min-height:22px; padding:2px 0; }
.fm-table .fm-ta { line-height:19px; background:none; }
.fm-table .fm-ta:hover, .fm-table .fm-ta:focus { background:rgba(180,83,42,.07); }
.fm-rmh, .fm-rmcell { width:26px; padding:0 !important; border:0 !important; background:none !important; text-align:center; }
.fm-rmcol { width:26px; }
.fm-rm { border:0; background:none; color:var(--fm-mute); font:400 16px/1 'FM Sans',sans-serif; padding:6px 4px; cursor:pointer; border-radius:3px; }
.fm-rm:hover { color:#fff; background:var(--fm-accent); }
.fm-add {
  margin-top:6px; font:500 7.5pt 'FM Mono','IBM Plex Mono',ui-monospace,monospace; letter-spacing:.06em; text-transform:uppercase;
  color:var(--fm-accent); background:transparent; border:1px dashed var(--fm-accent); border-radius:3px; padding:5px 12px; cursor:pointer;
}
.fm-add:hover { background:var(--fm-accent); color:#fff; }

@media print {
  .fm-paper { width:auto; padding:0; margin:0; box-shadow:none; background:none; }
  .fm-foot, .fm-add, .fm-rm, .fm-rmcell, .fm-rmh, .fm-rmcol { display:none !important; }
}
