/* ---------------------------------------------------------------------------
 * print-manual.css -- the manual on paper.
 *
 * Linked from docs.html with media="print", so none of this touches the
 * screen. scripts/manual-pdf.py prints docs.html and es/docs.html through
 * it into web/downloads/tivideck-manual-{en,es}.pdf; printing the page from
 * a browser gets the same layout without the title page.
 *
 * What changes on paper: white page and dark ink instead of the night sky;
 * no header, footer, menus, search, buttons or the Tivi bubble; the column
 * of links becomes the table of contents; every chapter starts a page; a
 * picture and its caption are never split; no picture is wider than 16 cm.
 * ------------------------------------------------------------------------- */

@page {
  size: letter;
  margin: 16mm 18mm 18mm;
  @bottom-left {
    content: "TiviDeck";
    font-family: 'Sora', 'Segoe UI', sans-serif; font-size: 8pt; font-weight: 700; color: #1d4ed8;
  }
  @bottom-right {
    content: counter(page);
    font-family: 'Segoe UI', sans-serif; font-size: 8pt; color: #6b7280;
  }
}
@page :first {
  @bottom-left { content: none; }
  @bottom-right { content: none; }
}

/* ---- ink: the site's tokens, turned for white paper ------------------- */
:root {
  --ink: #ffffff;
  --text: #111827;
  --muted: #303846;
  --faint: #59616f;
  --line: #d3d8e0;
  --line-soft: #e4e7ec;
  --panel: #f5f7fa;
  --panel-2: #f1f3f6;
  --green: #06804f;
  --blue-lift: #1d4ed8;
}
html, body { background: #fff !important; color: var(--text); }
body { font-size: 10.5pt; line-height: 1.5; overflow: visible; }
* { box-shadow: none !important; text-shadow: none !important; animation: none !important; transition: none !important; }
html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* ---- nothing you can only click --------------------------------------- */
.aurora, .grain, header.top, footer, dialog, .lb,
.tivi-fab, .tivi-fab-label, .tivi-panel,
.flabel, .finput, #manual-search, #manual-results, .manual-results,
.docjump, .lang-switch, .btn, .manual-pdf, button, input, select, textarea, details, video, iframe {
  display: none !important;
}

/* ---- one column, the full width of the paper --------------------------- */
main { display: block; }
.docs-shell { display: block; max-width: none; margin: 0; padding: 0; }
.docbody { max-width: none; }
.docbody > section { padding-top: 0; margin-top: 0 !important; break-before: page; }
.docbody section > h2 ~ h2 { break-before: page; }

a { color: var(--blue-lift); text-decoration: none; }

/* ---- the title page (manual-pdf.py adds it) ---------------------------- */
.print-cover {
  display: flex; flex-direction: column; justify-content: center;
  height: 228mm; break-after: page; padding: 0 6mm;
}
.print-cover img { width: 92mm; height: auto; margin: 0 0 16mm -2mm; }
.print-cover .print-cover-title {
  font-family: var(--display); font-weight: 700; font-size: 34pt; letter-spacing: -0.03em;
  line-height: 1.05; color: var(--text); margin: 0 0 7mm;
}
.print-cover .print-cover-versions { font-family: var(--display); font-size: 12.5pt; font-weight: 600; color: var(--text); margin: 0 0 2.5mm; }
.print-cover .print-cover-date { font-size: 11pt; color: var(--faint); margin: 0; }
.print-cover .print-cover-url { margin-top: auto; font-size: 10pt; color: var(--faint); }
.print-cover .print-cover-rule { width: 28mm; height: 1.4mm; border-radius: 1mm; margin: 0 0 7mm; background: linear-gradient(90deg, #003CD0, #0DE593); }

/* ---- the opening: the manual's own introduction, then the contents ---- */
.dochead { padding: 0 0 6mm; max-width: none; margin: 0; }
.dochead h1, .dochead .print-h1 {
  font-family: var(--display); font-weight: 700; font-size: 26pt; letter-spacing: -0.035em;
  margin: 2mm 0 4mm; line-height: 1.05; color: var(--text);
}
.dochead p, .dochead p.big { font-size: 10.5pt; color: var(--muted); max-width: none; line-height: 1.5; }

.docnav {
  display: block !important; position: static; max-height: none; overflow: visible; padding: 0;
  columns: 3; column-gap: 7mm; column-rule: 1px solid var(--line-soft);
  break-after: page;
}
.docnav::before {
  content: "Contents"; column-span: all; display: block;
  font-family: var(--display); font-weight: 700; font-size: 15pt; color: var(--text);
  margin: 0 0 2.5mm; padding-top: 3.5mm; border-top: 1px solid var(--line);
}
:lang(es) .docnav::before { content: "Contenido"; }
.docnav h4, .docnav .print-h4 {
  font-family: var(--display); font-size: 7.5pt; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--green); margin: 2.8mm 0 0.6mm; break-after: avoid;
}
.docnav h4:first-child, .docnav .print-h4:first-child { margin-top: 0; }
.docnav a {
  padding: 0.35mm 0; border: 0; border-radius: 0; background: none !important;
  color: var(--text); font-size: 8.5pt; line-height: 1.3; break-inside: avoid;
}

/* ---- reading ------------------------------------------------------------ */
.eyebrow { color: var(--green); font-size: 7.5pt; }
.docbody h2 { font-size: 22pt; margin: 1mm 0 4mm; color: var(--text); break-after: avoid; }
.docbody h3 { font-size: 13.5pt; margin: 7mm 0 2.5mm; color: var(--text); break-after: avoid; }
.docbody h2 + p, .docbody h3 + p, .docbody h3 + ul, .docbody h3 + ol { break-before: avoid; }
.docbody p { font-size: 10.5pt; line-height: 1.5; color: var(--muted); max-width: none; margin: 0 0 2.6mm; orphans: 3; widows: 3; }
.docbody p.big { font-size: 11.5pt; color: var(--text); }
.docbody ul, .docbody ol { max-width: none; }
.docbody ul li, .steps li { font-size: 10.5pt; line-height: 1.5; color: var(--muted); margin-bottom: 1.6mm; break-inside: avoid; }
.docbody ul li::before { top: 2.6mm; width: 1.5mm; height: 1.5mm; }
.steps { gap: 1.6mm; margin: 3mm 0 4mm; }
.steps li { padding-left: 9mm; }
.steps li::before { width: 6mm; height: 6mm; font-size: 8pt; top: 0; background: var(--panel-2); border-color: var(--line); color: var(--text); }

kbd {
  font-size: 8pt; color: var(--text); background: var(--panel-2);
  border: 1px solid #aeb5c2; border-bottom-width: 2px; padding: 0 1.4mm; border-radius: 1.2mm;
}

.note-card { max-width: none; background: #f2fbf7; border-color: var(--line); border-left: 1mm solid var(--green); padding: 3mm 4mm; margin: 4mm 0; break-inside: avoid; }
.note-card.warn { background: #fff8ec; border-left-color: #c77d0a; }
.note-card.warn .lbl { color: #9a5d00; }
.note-card .lbl { color: var(--green); }

.tablewrap, .table-scroll { overflow: visible; max-width: none; margin: 3mm 0 5mm; }
table.ref { max-width: none; min-width: 0; font-size: 9.5pt; }
table.ref th, table.ref td { padding: 1.8mm 2.5mm; border-bottom-color: var(--line); }
table.ref tr, .table-scroll tr { break-inside: avoid; }
.table-scroll table { font-size: 9.5pt; }
.table-scroll th, .table-scroll td { padding: 1.8mm 2.5mm; border-bottom-color: var(--line); color: var(--muted); }
.table-scroll th, .table-scroll td:first-child { color: var(--text); }
table.ref thead { display: table-header-group; }

/* ---- pictures: never split from their caption, never wider than 16 cm -- */
figure, .docshot, .shot { break-inside: avoid; page-break-inside: avoid; }
.docshot { max-width: 14.5cm; margin: 4mm auto 5mm; }
.docshot img {
  width: 100%; max-width: 16cm; height: auto; border-radius: 2mm;
  border: 1px solid var(--line); background: #fff; cursor: auto;
}
.docshot figcaption { font-size: 8.8pt; line-height: 1.4; color: var(--faint); max-width: none; margin-top: 2mm; }
.docshot figcaption b { color: var(--text); }

.docgrid { margin: 4mm 0 5mm; gap: 4mm; }
.docgrid.two { grid-template-columns: 1fr 1fr; }
.docgrid.two:not(.editions) { break-inside: avoid; }
.docgrid .docshot { margin: 0; max-width: none; }
.docgrid figcaption { font-size: 8.3pt; }

/* the phone pictures: whole, side by side, on white */
.docgrid.phones { margin-left: auto; margin-right: auto; grid-template-columns: repeat(auto-fit, minmax(36mm, 42mm)); justify-content: center; }
.shot { background: #fff; border: 1px solid var(--line); border-radius: 3mm; overflow: hidden; }
.shot img { max-height: none; }
.phones .shot { border-radius: 3mm; }
.phones .shot figcaption, .shot figcaption {
  position: static; display: block; background: #fff; border: 0; border-top: 1px solid var(--line-soft);
  backdrop-filter: none; border-radius: 0; color: var(--faint); font-size: 8pt; line-height: 1.35; padding: 1.6mm 2mm 2mm;
  letter-spacing: normal;
}
.shot figcaption b { color: var(--text); }

/* ---- where TiviDeck runs, and the two editions -------------------------- */
.avail { break-inside: avoid; }
.avail-chip { background: #fff; }
a.avail-chip.now { background: #f2fbf7; }
.avail-chip.soon { opacity: 1; color: var(--faint); }
.edition { background: #fff; border-color: var(--line); }
.lang-chip { background: #fff; color: var(--text); border-color: var(--line); }
.lang-pill { color: var(--blue-lift); background: #eef3ff; border-color: #b9c9f5; }
