/* Formatting vocabulary of rich text. Shared by the public pages (.prose) and the editing area of the
   admin editor, so what the editor shows is what the site renders. Classes only: the CSP forbids inline
   styles. Every name here is whitelisted per element in src/html.js (VOCAB) — keep the two in step. */

/* ───── palette (fixed hues with a dark-mode counterpart; everything else comes from theme tokens) ───── */
.prose {
  --tc-red: #b3261e; --tc-orange: #b45309; --tc-gold: #8a6508; --tc-green: #1d6b3a; --tc-teal: #0f6e6e;
  --tc-blue: #1d4ed8; --tc-purple: #6d28d9; --tc-pink: #b0246b; --tc-gray: #5b6472;
  --hl-yellow: #ffd83d; --hl-green: #7ee2a0; --hl-blue: #8cc4ff; --hl-pink: #ffa3cf; --hl-orange: #ffb86b;
  --hl-mix: 55%;
}
html[data-mode="dark"] .prose {
  --tc-red: #ff8a80; --tc-orange: #ffb067; --tc-gold: #e6c15a; --tc-green: #6fdc9b; --tc-teal: #5fd4d0;
  --tc-blue: #8ab4ff; --tc-purple: #c4a5ff; --tc-pink: #ff9ccb; --tc-gray: #a9b4c4;
  --hl-mix: 34%;
}
.prose { display: flow-root; } /* contains floated images */

/* ───── text colours and highlighter ───── */
.prose .tc-red { color: var(--tc-red); } .prose .tc-orange { color: var(--tc-orange); } .prose .tc-gold { color: var(--tc-gold); }
.prose .tc-green { color: var(--tc-green); } .prose .tc-teal { color: var(--tc-teal); } .prose .tc-blue { color: var(--tc-blue); }
.prose .tc-purple { color: var(--tc-purple); } .prose .tc-pink { color: var(--tc-pink); } .prose .tc-gray { color: var(--tc-gray); }
.prose .tc-primary { color: var(--c-link); } .prose .tc-accent { color: var(--c-accent); }
.prose [class*="hl-"] { padding: .05em .25em; border-radius: .25em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.prose .hl-yellow { background: color-mix(in srgb, var(--hl-yellow) var(--hl-mix), transparent); }
.prose .hl-green { background: color-mix(in srgb, var(--hl-green) var(--hl-mix), transparent); }
.prose .hl-blue { background: color-mix(in srgb, var(--hl-blue) var(--hl-mix), transparent); }
.prose .hl-pink { background: color-mix(in srgb, var(--hl-pink) var(--hl-mix), transparent); }
.prose .hl-orange { background: color-mix(in srgb, var(--hl-orange) var(--hl-mix), transparent); }
.prose .hl-primary { background: var(--c-primary-soft); }

/* ───── sizes and families (faces are declared in /assets/fonts.css) ───── */
.prose .fs-sm { font-size: .85em; } .prose .fs-lg { font-size: 1.2em; } .prose .fs-xl { font-size: 1.45em; line-height: 1.7; } .prose .fs-2xl { font-size: 1.8em; line-height: 1.55; }
.prose .ff-naskh { font-family: "Noto Naskh Arabic", Georgia, "Times New Roman", serif; }
.prose .ff-amiri { font-family: "Amiri", "Noto Naskh Arabic", Georgia, serif; font-weight: 700; }
.prose .ff-kufi { font-family: "Noto Kufi Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif; }
.prose .ff-plex { font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif; }
.prose .ff-readex { font-family: "Readex Pro", "Segoe UI", Tahoma, sans-serif; }
.prose .ff-almarai { font-family: "Almarai", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif; }
.prose .ff-rubik { font-family: "Rubik", "Segoe UI", Tahoma, sans-serif; }
.prose .ff-changa { font-family: "Changa", "Segoe UI", Tahoma, sans-serif; }
.prose .ff-reemkufi { font-family: "Reem Kufi", "Noto Kufi Arabic", "Segoe UI", sans-serif; font-weight: 700; }
.prose .ff-poppins { font-family: "Poppins", "IBM Plex Sans", "Segoe UI", Arial, sans-serif; }
.prose .ff-nunito { font-family: "Nunito", "IBM Plex Sans", "Segoe UI", Arial, sans-serif; }
.prose .ff-cormorant { font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif; font-weight: 600; font-size: 1.12em; }
.prose .ff-syne { font-family: "Syne", "IBM Plex Sans", "Segoe UI", Arial, sans-serif; }

/* ───── paragraph options ───── */
/* base.css resets paragraph margins with a rule stronger than its own spacing rule: restore the gap */
.prose > * + p, .prose li > * + p, .prose :is(td, th) > * + p { margin-block-start: 1.15em; }
.prose :is(td, th):empty::after { content: "\00a0"; }
.prose .lh-tight { line-height: 1.55; } .prose .lh-loose { line-height: 2.6; }
.prose .indent-1 { margin-inline-start: 2em; } .prose .indent-2 { margin-inline-start: 4em; } .prose .indent-3 { margin-inline-start: 6em; }
.prose p.lead { font-size: 1.2em; line-height: 1.9; font-weight: 500; color: var(--c-text); padding-inline-start: .9em; border-inline-start: 4px solid var(--c-accent); }
.prose blockquote > * + * { margin-block-start: .6em; }
.prose blockquote.pull { background: none; border: 0; border-block: 2px solid var(--c-accent); border-radius: 0; padding: 1.1em .5em; text-align: center; font-family: var(--font-head); font-size: 1.35em; line-height: 1.8; font-weight: 700; color: var(--c-text); }
/* alignment is an explicit choice: it wins over the direction of the block and over table-cell defaults */
.prose :is(p, h2, h3, h4, div, li, td, th, blockquote, figure).ta-center { text-align: center; }
.prose :is(p, h2, h3, h4, div, li, td, th, blockquote, figure).ta-right { text-align: right; }
.prose :is(p, h2, h3, h4, div, li, td, th, blockquote, figure).ta-left { text-align: left; }
.prose :is(p, h2, h3, h4, div, li, td, th, blockquote, figure).ta-justify { text-align: justify; }

/* ───── label and button link ───── */
.prose .tag { display: inline-block; padding: 0 .65em; border-radius: 999px; background: var(--c-primary-soft); color: var(--c-link); font-size: .8em; font-weight: 700; line-height: 1.9; vertical-align: middle; white-space: nowrap; }
.prose .tag--accent { background: var(--c-accent-soft); color: var(--c-text); }
.prose .tag--ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.prose .tag--warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.prose .tag--danger { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.prose a.btn-link { display: inline-flex; align-items: center; justify-content: center; gap: .4em; max-width: 100%; padding: .45em 1.3em; border-radius: var(--radius); border: 2px solid var(--c-primary); background: var(--c-primary); color: var(--c-primary-ink); font-weight: 700; line-height: 1.6; text-decoration: none; text-align: center; transition: filter .2s, box-shadow .2s; }
.prose a.btn-link:hover { filter: brightness(1.1); box-shadow: var(--shadow-1); }
.prose a.btn-link--ghost { background: transparent; color: var(--c-link); }
.prose a.btn-link--ghost:hover { background: var(--c-primary-soft); filter: none; }

/* ───── callout boxes ───── */
.prose .box { --box: var(--c-primary); padding: .9em 1.15em; border: 1px solid color-mix(in srgb, var(--box) 30%, var(--c-border)); border-inline-start: 5px solid var(--box); border-radius: var(--radius); background: color-mix(in srgb, var(--box) 8%, var(--c-surface)); color: var(--c-text); break-inside: avoid; }
.prose .box > * + * { margin-block-start: .55em; }
.prose .box--info { --box: var(--c-primary); } .prose .box--success { --box: var(--ok); } .prose .box--warn { --box: var(--warn); }
.prose .box--danger { --box: var(--danger); } .prose .box--note { --box: var(--c-accent); }
.prose .box__title { font-family: var(--font-head); font-weight: 700; font-size: 1.08em; color: color-mix(in srgb, var(--box) 78%, var(--c-text)); }

/* ───── columns ───── */
.prose .cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap, 1.5rem); align-items: start; }
.prose .col > * + * { margin-block-start: 1em; }
@media (min-width: 700px) {
  .prose .cols--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prose .cols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ───── lists ───── */
.prose ul ul, .prose ul ol, .prose ol ul, .prose ol ol { margin-block-start: .35em; }
.prose ul.checks { list-style: none; padding-inline-start: 0; }
.prose ul.checks > li { position: relative; padding-inline-start: 2em; }
.prose ul.checks > li::before { content: ""; position: absolute; inset-inline-start: .15em; inset-block-start: .5em; width: 1.15em; height: 1.15em; border-radius: 50%; background: var(--ok); }
.prose ul.checks > li::after { content: ""; position: absolute; inset-inline-start: .52em; inset-block-start: .72em; width: .36em; height: .62em; border: solid var(--c-surface); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.prose ol.steps { list-style: none; padding-inline-start: 0; counter-reset: step; }
.prose ol.steps > li { position: relative; counter-increment: step; padding-inline-start: 3em; padding-block-end: .9em; min-height: 2.4em; }
.prose ol.steps > li + li { margin-block-start: 0; }
.prose ol.steps > li::before { content: counter(step); position: absolute; inset-inline-start: 0; inset-block-start: .1em; width: 2.1em; height: 2.1em; display: grid; place-items: center; border-radius: 50%; background: var(--c-primary); color: var(--c-primary-ink); font-weight: 700; font-size: .9em; line-height: 1; }
.prose ol.steps > li::after { content: ""; position: absolute; inset-inline-start: .93em; inset-block: 2.2em 0; width: 2px; background: var(--c-border); }
.prose ol.steps > li:last-child::after { display: none; }

/* ───── dividers ───── */
.prose hr.hr--sm { margin-block: 1em; } .prose hr.hr--lg { margin-block: 3.5em; }
.prose hr.hr--dots { border: 0; height: auto; text-align: center; margin-block: 1.6em; }
.prose hr.hr--dots::before { content: "•  •  •"; color: var(--c-accent); font-size: 1.3em; letter-spacing: .3em; }

/* ───── tables ───── */
.prose th { background: var(--c-primary-soft); font-weight: 700; }
.prose table.tbl--nohead tr:first-child > td { background: transparent; font-weight: inherit; }
.prose table.tbl--striped tr:nth-child(even) > td { background: var(--c-primary-soft); }
.prose table.tbl--striped tr:nth-child(odd) > td { background: transparent; }
.prose table.tbl--bordered :is(th, td) { border: 1px solid var(--c-border); }
.prose table.tbl--compact { font-size: .86em; }
.prose table.tbl--compact :is(th, td) { padding: .3rem .55rem; }
.prose table.tbl--kv tr > :is(td, th):first-child { background: var(--c-primary-soft); font-weight: 700; width: 32%; }
.prose table.tbl--kv tr > :is(td, th):not(:first-child) { background: transparent; font-weight: inherit; }

/* ───── images and captions ───── */
.prose figure { margin-inline: 0; }
.prose figure > img, .prose figure > a > img { display: block; margin-inline: auto; }
.prose figcaption { margin-block-start: .5em; text-align: center; font-size: .86em; line-height: 1.7; color: var(--c-muted); }
.prose :is(img, figure).img-center { display: block; margin-inline: auto; }
.prose figure.img-center { width: fit-content; max-width: 100%; }
.prose :is(img, figure).img-sm { width: 14rem; max-width: 100%; }
.prose :is(img, figure).img-md { width: 26rem; max-width: 100%; }
.prose :is(img, figure).img-full { width: 100%; }
.prose figure:is(.img-sm, .img-md, .img-full) > img { width: 100%; }
.prose :is(img, figure).img-start { float: inline-start; max-width: 46%; margin-block: .3em .8em; margin-inline: 0 1.4em; }
.prose :is(img, figure).img-end { float: inline-end; max-width: 46%; margin-block: .3em .8em; margin-inline: 1.4em 0; }
.prose :is(h2, h3, hr, table, .table-wrap, .box, .cols) { clear: both; }
@media (max-width: 560px) {
  .prose :is(img, figure):is(.img-start, .img-end) { float: none; display: block; max-width: 100%; margin-inline: auto; }
  .prose .indent-1, .prose .indent-2, .prose .indent-3 { margin-inline-start: 1em; }
  .prose .fs-2xl { font-size: 1.5em; } .prose .fs-xl { font-size: 1.3em; }
  .prose a.btn-link { padding-inline: 1em; }
}

@media print {
  .prose [class*="hl-"], .prose .box, .prose th, .prose .tag, .prose ol.steps > li::before, .prose ul.checks > li::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .prose .box, .prose figure, .prose blockquote, .prose tr { break-inside: avoid; }
  .prose a.btn-link { background: none; color: inherit; border: 1px solid; box-shadow: none; }
  .prose .cols--2, .prose .cols--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
