/* --------------------------------------------|
|                                              |
| Component Icon                               |
|                                              |
| Markup: snippets/icon.php — always           |
| <span class="icon icon--{name}"><svg>…       |
|                                              |
| Size:   --icon-size (default 1em, so the     |
|         icon scales with the text)           |
| Colour: color (files draw in currentColor)   |
|                                              |
| Context classes only set --icon-size; they   |
| never style the <svg> itself.                |
|                                              |
|-------------------------------------------- */

.icon {
	--icon-size: 1em;
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: var(--icon-size);
	height: var(--icon-size);
	/* Sits on the text baseline like a lowercase letter. */
	vertical-align: -0.125em;
	line-height: 1;
}

.icon > svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* The global `svg { fill: currentColor }` (utility.css) beats the fill="none"
   presentation attribute of stroke-drawn files; give it back. */
.icon > svg[fill="none"] {
	fill: none;
}

/* Visible only with debug on (snippets/icon.php). */
.icon--missing {
	outline: 1px dashed var(--color-error, red);
	color: var(--color-error, red);
	font-size: 0.75em;
}

/* --------------------------------------------|
| Sizes in context                             |
|-------------------------------------------- */

/* Social links in header and footer */
.li--icon .icon {
	--icon-size: 20px;
}

/* Arrow after external links in main navigation and submenu */
.icon--external {
	--icon-size: 0.75em;
	margin-left: calc(var(--spacing) * 1);
}

/* File type in download lists */
.download-list__icon {
	--icon-size: 36px;
}
