/* How article text looks.
 *
 * One file for three places: the public page, the editing surface and the
 * preview. "Psaní" and "Náhled" are expected to look the same as the finished
 * page, and the only way to keep that promise over time is to have a single
 * set of rules rather than three that drift apart.
 *
 * The colours come from whichever stylesheet is loaded alongside — site.css
 * or admin.css — through the --c-* names each of them defines.
 */

.prose,
.editor-surface,
.editor-preview {
  font-size: 17px;
  line-height: 1.6;
  color: var(--c-text);
}

.prose > :first-child,
.editor-surface > :first-child,
.editor-preview > :first-child { margin-top: 0; }

.prose > :last-child,
.editor-surface > :last-child,
.editor-preview > :last-child { margin-bottom: 0; }

.prose p,
.editor-surface p,
.editor-preview p { margin: 0 0 .85em; }

.prose h2,
.editor-surface h2,
.editor-preview h2 {
  margin: 1.5em 0 .4em;
  font-size: 1.45em;
  line-height: 1.22;
  color: var(--c-strong);
}

.prose h3,
.editor-surface h3,
.editor-preview h3 {
  margin: 1.3em 0 .35em;
  font-size: 1.2em;
  line-height: 1.28;
  color: var(--c-strong);
}

.prose h4,
.editor-surface h4,
.editor-preview h4 {
  margin: 1.2em 0 .3em;
  font-size: 1.05em;
  color: var(--c-strong);
}

.prose ul, .prose ol,
.editor-surface ul, .editor-surface ol,
.editor-preview ul, .editor-preview ol { margin: 0 0 .85em; padding-left: 1.35em; }

.prose li,
.editor-surface li,
.editor-preview li { margin: .2em 0; }

/* Citace je od okolního textu oddělená pruhem i podkladem, ne jen odsazením.
   Samotná linka po straně se v delším článku ztratila a nebylo poznat, kde
   citace začíná a kde končí. */
.prose blockquote,
.editor-surface blockquote,
.editor-preview blockquote {
  margin: 1.5em 0;
  padding: 14px 20px;
  border-left: 4px solid var(--c-accent);
  border-radius: 0 10px 10px 0;
  background: var(--c-quiet);
  color: var(--c-strong);
}
/* Odstavec uvnitř citace nesmí přidat prázdno pod podkladem. */
.prose blockquote > :first-child,
.editor-surface blockquote > :first-child,
.editor-preview blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child,
.editor-surface blockquote > :last-child,
.editor-preview blockquote > :last-child { margin-bottom: 0; }

.prose hr,
.editor-surface hr,
.editor-preview hr {
  border: 0;
  border-top: 1px solid var(--c-line);
  margin: 1.8em 0;
}

.prose img,
.editor-surface img,
.editor-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.prose figure,
.editor-surface figure,
.editor-preview figure { margin: 1.4em 0; }

.prose figcaption,
.editor-surface figcaption,
.editor-preview figcaption {
  margin-top: .5em;
  font-size: .85em;
  color: var(--c-muted);
}

.prose code,
.editor-surface code,
.editor-preview code {
  background: var(--c-quiet);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.prose pre,
.editor-surface pre,
.editor-preview pre {
  background: var(--c-quiet);
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 13px 15px;
  overflow: auto;
}

.prose pre code,
.editor-surface pre code,
.editor-preview pre code { background: none; padding: 0; }

.prose table,
.editor-surface table,
.editor-preview table {
  border-collapse: collapse;
  width: 100%;
  font-size: .94em;
  margin: 0 0 1.2em;
}

.prose th, .prose td,
.editor-surface th, .editor-surface td,
.editor-preview th, .editor-preview td {
  text-align: left;
  padding: 8px 11px;
  border-bottom: 1px solid var(--c-line);
}

.prose th,
.editor-surface th,
.editor-preview th {
  color: var(--c-strong);
  font-weight: 650;
  background: var(--c-quiet);
}

/* The public page holds a reading measure; the editor fills its box, because
   an editor that is narrower than its frame just looks broken. */
.prose { max-width: 68ch; }
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; }
.table-wrap table { margin: 0; }

/* An embedded video keeps the player's proportions and the page's width.
   Only YouTube can appear here; internal/htmlsafe allows nothing else. */
.prose iframe,
.editor-surface iframe,
.editor-preview iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 8px;
  background: #000;
  margin: 1.2em 0;
}

/* Barevný text.
 *
 * Editor nabízí tenhle pevný seznam jmen místo výběru odstínu z palety, takže
 * se na webu nesejde pět skoro stejných zelených. Jméno tady dostane skutečnou
 * barvu — a protože je za ním proměnná, funguje i v tmavém režimu, což by
 * napevno zapsaný kód barvy neuměl. internal/htmlsafe propustí jen tahle jména.
 */

.prose .barva-zelena,
.editor-surface .barva-zelena,
.editor-preview .barva-zelena { color: var(--c-zelena); }

.prose .barva-tyrkysova,
.editor-surface .barva-tyrkysova,
.editor-preview .barva-tyrkysova { color: var(--c-tyrkysova); }

.prose .barva-modra,
.editor-surface .barva-modra,
.editor-preview .barva-modra { color: var(--c-modra); }

.prose .barva-fialova,
.editor-surface .barva-fialova,
.editor-preview .barva-fialova { color: var(--c-fialova); }

.prose .barva-ruzova,
.editor-surface .barva-ruzova,
.editor-preview .barva-ruzova { color: var(--c-ruzova); }

.prose .barva-cervena,
.editor-surface .barva-cervena,
.editor-preview .barva-cervena { color: var(--c-cervena); }

.prose .barva-oranzova,
.editor-surface .barva-oranzova,
.editor-preview .barva-oranzova { color: var(--c-oranzova); }

.prose .barva-okrova,
.editor-surface .barva-okrova,
.editor-preview .barva-okrova { color: var(--c-okrova); }

.prose .barva-hneda,
.editor-surface .barva-hneda,
.editor-preview .barva-hneda { color: var(--c-hneda); }

.prose .barva-seda,
.editor-surface .barva-seda,
.editor-preview .barva-seda { color: var(--c-seda); }
