/*
Name: tag auto mumbering by css
Version: 1.8.1
Description: styling for automatic numbering of items
Author: Eric POSTLACK
Author URI: https://postlack.de
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Usage: add the corresponding classes to html tags
*/

/* Auto-numbering for headings and lists */
#l46_tag_auto_numbering {
	counter-reset: l46_h1counter l46_h2counter l46_h3counter l46_h4counter l46_pcounter l46_scounter;
}

/* Increment and reset counters for h1 */
#l46_tag_auto_numbering h1 {
	counter-increment: l46_h1counter;
	counter-reset: l46_h2counter l46_h3counter l46_h4counter l46_pcounter l46_scounter;
}

/* Increment and reset counters for h2 */
#l46_tag_auto_numbering h2 {
	counter-increment: l46_h2counter;
	counter-reset: l46_h3counter l46_h4counter l46_pcounter l46_scounter;
}

/* Increment and reset counters for h3 only if it follows h2 */
#l46_tag_auto_numbering h2+h3,
#l46_tag_auto_numbering h2~h3:not(h3 ~ h3) {
	counter-increment: l46_h3counter;
	counter-reset: l46_h4counter l46_pcounter l46_scounter;
}

/* Increment and reset counters for h4 only if it follows h3 */
#l46_tag_auto_numbering h3+h4,
#l46_tag_auto_numbering h3~h4:not(h4 ~ h4) {
	counter-increment: l46_h4counter;
	counter-reset: l46_pcounter l46_scounter;
}

/* Increment counters for h3 and h4 if they follow the same level */
#l46_tag_auto_numbering h3~h3,
#l46_tag_auto_numbering h4~h4 {
	counter-increment: l46_h3counter;
}

/* Pseudo-element content for headings */
#l46_tag_auto_numbering h2::before {
	content: counter(l46_h2counter) ". ";
}

#l46_tag_auto_numbering h3::before {
	content: counter(l46_h2counter) "." counter(l46_h3counter) " ";
}

#l46_tag_auto_numbering h4::before {
	content: "(" counter(l46_h4counter) ") ";
	padding: 0.25em;
}

/* List numbering */
#l46_tag_auto_numbering .l46_list_alp_np {
	counter-increment: l46_pcounter;
}

#l46_tag_auto_numbering .l46_list_alp_np::before {
	content: counter(l46_pcounter, lower-alpha) ") ";
	padding: 0.5em;
}

#l46_tag_auto_numbering .l46_list_disc {
	counter-increment: l46_lcounter;
}

#l46_tag_auto_numbering .l46_list_disc::before {
	content: counter(l46_lcounter, lower-alpha) ") ";
	padding: 1em;
}

/* Paragraph styling */
#l46_tag_auto_numbering p {
	margin: 0 0 0.25em;
	line-height: 1.25;
}

#l46_tag_auto_numbering p#l46-version {
	font-style: italic;
	font-size: 0.75em;
}