/*
 * Sdílené styly pro rich-text obsah z editoru.
 * Načítají se na dvou místech:
 *   1) TinyMCE iframe (přes content_css ve WysiwygEditor; body má class "rich-text")
 *   2) Veřejný frontend (přes <link> v index.html; obsah obalen .rich-text divem)
 * Cíl: editor a renderovaná stránka vypadají stejně.
 */

.rich-text {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: hsl(210, 50%, 15%);
  word-wrap: break-word;
  /* Sjednocená šířka pro 1:1 editor + render. Na renderované stránce je rodič
     `container max-w-6xl` užší, takže max-width je no-op; v iframe constrains. */
  max-width: 72rem; /* 1152 px = max-w-6xl */
  margin-left: auto;
  margin-right: auto;
}

/* Editor-only: matchuje v TinyMCE iframe (body má class rich-text). 2rem horiz
   padding sedí s container paddingem (2rem) na renderované stránce, takže
   content-area je v obou kontextech ~1088 px. */
body.rich-text {
  padding: 12px 2rem;
  box-sizing: border-box;
}

.rich-text h2,
.rich-text h3,
.rich-text h4 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: inherit;
}
.rich-text h2 { font-size: 1.5em;  margin: 0.6em 0 0.3em; }
.rich-text h3 { font-size: 1.25em; margin: 0.6em 0 0.3em; }
.rich-text h4 { font-size: 1.1em;  margin: 0.5em 0 0.25em; }

.rich-text p { margin: 0.4em 0; }

.rich-text ul,
.rich-text ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}
.rich-text ul { list-style: disc; }
.rich-text ol { list-style: decimal; }
.rich-text li { margin: 0.2em 0; }
.rich-text li > ul,
.rich-text li > ol { margin: 0.2em 0; }

.rich-text a {
  color: hsl(205, 85%, 40%);
  text-decoration: underline;
}
.rich-text a:hover { color: hsl(210, 80%, 35%); }

/* Emoji ikona se přidá jen když link nemá vlastní <img> uvnitř —
   importovaný Joomla obsah už má vlastní icon-pdf/icon-word obrázky,
   nepřebíjet je. */
.rich-text a[href$=".pdf" i]:not(:has(img))::before { content: "📄 "; }
.rich-text a[href$=".doc" i]:not(:has(img))::before,
.rich-text a[href$=".docx" i]:not(:has(img))::before { content: "📝 "; }
.rich-text a[href$=".xls" i]:not(:has(img))::before,
.rich-text a[href$=".xlsx" i]:not(:has(img))::before { content: "📊 "; }

.rich-text img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

.rich-text blockquote {
  margin: 0.8em 0;
  padding: 0.4em 1em;
  border-left: 3px solid hsl(200, 30%, 80%);
  color: hsl(210, 25%, 35%);
  font-style: italic;
}

.rich-text pre {
  margin: 0.6em 0;
  padding: 0.6em 0.8em;
  background: hsl(200, 30%, 96%);
  border-radius: 6px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9em;
  overflow-x: auto;
}
.rich-text code {
  background: hsl(200, 30%, 94%);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9em;
}
.rich-text pre code {
  background: none;
  padding: 0;
}

.rich-text hr {
  border: 0;
  border-top: 1px solid hsl(200, 30%, 85%);
  margin: 1em 0;
}

/* Tabulky bez defaultního borderu — odpovídá staré Joomle. Pokud má redaktor
   konkrétní tabulku zarámovat, přidá si border přes inline style v editoru
   (sanitizer style atribut povoluje, vč. border vlastností). */
.rich-text table {
  border-collapse: collapse;
  margin: 0.6em 0;
}
.rich-text th,
.rich-text td {
  padding: 0.4em 0.6em;
  vertical-align: top;
  text-align: left;
}
.rich-text th {
  background: hsl(200, 30%, 94%);
  font-weight: 600;
}

/* Drobnosti pro inline formátování */
.rich-text strong, .rich-text b { font-weight: 700; }
.rich-text em, .rich-text i { font-style: italic; }
.rich-text small { font-size: 0.85em; }
.rich-text sub, .rich-text sup { font-size: 0.75em; line-height: 0; }
