/*
 * Copyright © 2026 Krzysztof Kasprowicz
 * Licensed under the GNU Affero General Public License, Version 3. See LICENSE in the project root for license information.
 * Project repository: https://github.com/fathomise/MailFathom
 */

/* The page of a report the Agent writes. The paper is the PDF the service sets, and a PDF has one face: it stays
   white with dark ink in both themes, and only the desk it lies on follows the theme. Sizes on the paper are in
   points, so they read as what the PDF is set in; one A4 page is 595 x 842 pt. */

body { margin: 0; background: var(--bg); color: var(--text); }

.desk { box-sizing: border-box; max-width: 1340px; margin: 0 auto; padding: 32px 16px 64px; display: flex; flex-direction: column; gap: 28px; }
.desk h1 { margin: 0; font-size: 22px; font-weight: 600; }
.lede { margin: 0; max-width: 820px; font-size: 14px; line-height: 1.55; color: var(--text2); }

.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.note { padding: 14px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.note h2 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text); }
.note p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.note .specimen-serif { font-family: 'Source Serif 4', Georgia, serif; font-size: 17px; color: var(--text); }
.note .specimen-sans { font-family: 'Geist', system-ui, sans-serif; font-size: 15px; color: var(--text); }

.pages { display: flex; flex-wrap: wrap; gap: 28px; justify-content: center; }
/* Scaled to the width it is given, so a phone sees a whole page rather than a corner of one. */
.page-frame { width: calc(595pt * var(--page-scale, 1)); height: calc(842pt * var(--page-scale, 1)); flex: 0 0 auto; }
.page-label { font-size: 12px; color: var(--faint); margin: 0 0 8px; }

.page {
  --ink: #1d2230; --ink2: #3f4554; --ink3: #6a7080; --rule: #d9dce3; --tint: #f3f4f7; --mark: #2f4fb3;
  box-sizing: border-box; width: 595pt; height: 842pt; transform: scale(var(--page-scale, 1)); transform-origin: 0 0;
  position: relative; overflow: hidden; background: #ffffff; color: var(--ink);
  box-shadow: 0 1px 2px var(--sh-1), 0 12px 32px var(--sh-2);
  padding: 56pt 57pt 72pt; display: flex; flex-direction: column; gap: 9pt;
  font-family: 'Source Serif 4', Georgia, serif; font-size: 10.5pt; line-height: 1.5; font-variant-numeric: normal;
  font-optical-sizing: auto; text-rendering: optimizeLegibility;
}

/* The title block: page one alone. */
.title-block { display: flex; flex-direction: column; gap: 6pt; padding-bottom: 14pt; margin-bottom: 6pt; border-bottom: 1.5pt solid var(--ink); }
.title-block .kind { font-family: 'Geist', system-ui, sans-serif; font-size: 8pt; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mark); }
.title-block .title { font-family: 'Geist', system-ui, sans-serif; font-size: 22pt; line-height: 1.15; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.title-block .written { font-family: 'Geist', system-ui, sans-serif; font-size: 9pt; color: var(--ink3); }

/* The running foot: every page, in the bottom margin. */
.foot { position: absolute; left: 57pt; right: 57pt; bottom: 30pt; display: flex; justify-content: space-between; gap: 12pt; padding-top: 7pt; border-top: 0.75pt solid var(--rule); font-family: 'Geist', system-ui, sans-serif; font-size: 8pt; color: var(--ink3); font-variant-numeric: tabular-nums; }

/* What the Markdown may carry. */
.page h2, .page h3, .page h4 { font-family: 'Geist', system-ui, sans-serif; margin: 0; color: var(--ink); font-weight: 600; break-after: avoid; }
.page h2 { font-size: 15pt; line-height: 1.25; margin-top: 8pt; }
.page h3 { font-size: 12pt; line-height: 1.3; margin-top: 4pt; }
.page h4 { font-size: 10pt; line-height: 1.35; letter-spacing: 0.02em; color: var(--ink2); }
.page p { margin: 0; text-wrap: pretty; hyphens: auto; }
.page em { font-style: italic; }
/* Geist has no italic, so emphasis set in it - inside a table - takes the medium weight instead. */
.page table em { font-style: normal; font-weight: 500; color: var(--ink); }
.page strong { font-weight: 600; }
.page ul, .page ol { margin: 0; padding-left: 16pt; display: flex; flex-direction: column; gap: 3pt; }
.page li::marker { color: var(--ink3); }
.page sup.cite { font-family: 'Geist', system-ui, sans-serif; font-size: 7pt; font-weight: 600; color: var(--mark); margin-left: 1pt; }

.page blockquote { margin: 2pt 0; padding: 6pt 0 6pt 12pt; border-left: 2pt solid var(--rule); color: var(--ink2); display: flex; flex-direction: column; gap: 4pt; }
.page blockquote .from { font-family: 'Geist', system-ui, sans-serif; font-size: 8.5pt; color: var(--ink3); font-style: normal; }

.page table { width: 100%; border-collapse: collapse; font-family: 'Geist', system-ui, sans-serif; font-size: 8.5pt; line-height: 1.4; font-variant-numeric: tabular-nums; }
.page th { text-align: left; font-weight: 600; color: var(--ink); padding: 5pt 6pt; border-bottom: 1pt solid var(--ink); background: var(--tint); vertical-align: bottom; }
.page td { padding: 5pt 6pt; border-bottom: 0.5pt solid var(--rule); vertical-align: top; color: var(--ink2); }
.page td.num, .page th.num { text-align: right; }

/* The list of sources that closes a report. */
.sources { display: flex; flex-direction: column; gap: 0; padding: 0; margin: 0; list-style: none; counter-reset: src; }
.sources li { counter-increment: src; display: grid; grid-template-columns: 18pt 1fr; gap: 0 4pt; padding: 6pt 0; border-bottom: 0.5pt solid var(--rule); }
.sources li::before { content: counter(src); font-family: 'Geist', system-ui, sans-serif; font-size: 8pt; font-weight: 600; color: var(--mark); padding-top: 1.5pt; }
.sources .subject { font-weight: 600; }
.sources .who { grid-column: 2; font-family: 'Geist', system-ui, sans-serif; font-size: 8.5pt; color: var(--ink3); }
