/* ==========================================================================
   Journaler — printing.
   - The /print page (body.print-page): on screen it looks like sheets of paper; printed, each day
     starts on a new page with its date as a heading.
   - Ctrl+P on the journal page: prints just the current day, without any app chrome.
   Works with the browser's "Save as PDF".
   ========================================================================== */

/* ---------- Print page on screen ---------- */

body.print-page { background: var(--bg); }
.print-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.print-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 auto 0 0; font-size: .9rem; }
.print-range input[type="date"] { width: auto; min-height: 32px; padding: 4px 8px; }
.print-sheets { padding: 24px 16px 64px; }
.print-day {
    max-width: 210mm;
    margin: 0 auto 24px;
    padding: 18mm 16mm;
    background: #fff;
    color: #1a1a1a;
    box-shadow: 0 1px 3px rgb(0 0 0 / .15), 0 8px 24px rgb(0 0 0 / .08);
}

/* ---------- Shared document typography (screen sheets + paper) ---------- */

.print-day { font: 11.5pt/1.55 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
.print-day-header { margin-bottom: 14pt; padding-bottom: 8pt; border-bottom: 1px solid #ccc; }
.print-day-header h1 { margin: 0; font-size: 20pt; line-height: 1.2; }
.print-meta { margin: 4pt 0 0; color: #666; font: 9pt system-ui, sans-serif; }
.print-content h1 { font-size: 17pt; } .print-content h2 { font-size: 14.5pt; } .print-content h3 { font-size: 12.5pt; }
.print-content h1, .print-content h2, .print-content h3 { margin: 12pt 0 4pt; line-height: 1.25; }
.print-content p { margin: 0 0 6pt; }
.print-content p:has(> br:only-child) { margin: 0; }
.print-content img { display: block; max-width: 100%; max-height: 180mm; margin: 6pt 0; border-radius: 3px; }
.print-content a { color: inherit; }
.print-content blockquote { margin: 6pt 0; padding-left: 10pt; border-left: 2pt solid #bbb; color: #444; }
.print-content pre { margin: 6pt 0; padding: 6pt 8pt; background: #f4f4f4; font: 9.5pt/1.4 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
.print-content code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
.print-content ul, .print-content ol { margin: 0 0 6pt; padding-left: 18pt; }
.print-content ul.checklist { list-style: none; padding-left: 4pt; }
.print-content ul.checklist ul.checklist { padding-left: 18pt; }
.print-content ul.checklist > li::before { content: "☐"; display: inline-block; width: 14pt; margin-left: -2pt; }
.print-content ul.checklist > li[data-checked="true"]::before { content: "☑"; }
.print-content ul.checklist > li[data-checked="true"] { color: #777; text-decoration: line-through; }
.print-content .indent-1 { padding-left: 18pt; } .print-content .indent-2 { padding-left: 36pt; } .print-content .indent-3 { padding-left: 54pt; }
.print-attachments { margin-top: 14pt; padding-top: 8pt; border-top: 1px solid #ddd; font-size: 10pt; }
.print-attachments h2 { margin: 0 0 4pt; font: 600 9pt system-ui, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: #666; }
.print-attachments ul { margin: 0; padding-left: 14pt; }
.print-file-meta { color: #777; }
.print-empty h1 { font-size: 18pt; }

/* ---------- Paper ---------- */

@page { margin: 16mm 15mm 18mm; }

@media print {
    html, body { background: #fff !important; color: #000 !important; }
    body { font-size: 11.5pt; }

    /* No app chrome anywhere */
    .no-print, .skip-link, .app-header, .sidebar, .toasts, dialog, .drop-overlay, .focus-exit,
    .dictation-dock, .dictation-interim, .ql-toolbar, .day-nav, .day-banner, .save-status,
    .attachments-head label, .attachments-hint, .attachment-actions, .attachment-open { display: none !important; }

    /* /print page: sheets become pages */
    .print-sheets { padding: 0; }
    .print-day { max-width: none; margin: 0; padding: 0; box-shadow: none; }
    .print-day + .print-day { break-before: page; }
    .print-day-header, .print-content h1, .print-content h2, .print-content h3 { break-after: avoid; }
    .print-content img, .print-content pre, .print-content blockquote { break-inside: avoid; }

    /* Ctrl+P on the journal page: just the day */
    body.is-journal .shell { display: block; min-height: 0; }
    body.is-journal .workspace, body.is-journal .paper { max-width: none; margin: 0; padding: 0; background: #fff; }
    body.is-journal .day-header { display: block; margin: 0 0 12pt; padding-bottom: 8pt; border-bottom: 1px solid #ccc; }
    body.is-journal .day-kicker { display: none; }
    body.is-journal .day-title { font-size: 20pt; color: #000; }
    body.is-journal .ql-container.ql-snow { font-size: 11.5pt; }
    body.is-journal .ql-editor { min-height: 0; padding: 0; color: #000; overflow: visible; }
    body.is-journal .ql-editor.ql-blank::before { content: none; }
    body.is-journal .ql-editor img { break-inside: avoid; }
    body.is-journal .attachments { break-inside: avoid; border-top: 1px solid #ddd; }
    body.is-journal .attachments.is-empty { display: none; }
    body.is-journal .attachment-list { display: block; margin: 4pt 0 0; padding-left: 14pt; list-style: disc; }
    body.is-journal .attachment { display: list-item; padding: 0; border: 0; background: none; }
    body.is-journal .attachment-name { font-weight: normal; color: #000; white-space: normal; }
    body.is-journal .attachment-meta::before { content: " ("; }
    body.is-journal .attachment-meta::after { content: ")"; }
    body.is-journal .attachment-meta, body.is-journal .attachment-info { display: inline; }
}
