/*
 * Guide article components (docs/ARTICLE-DESIGN.md).
 *
 * Loaded on a guide single ONLY. article.css also serves archives, search and
 * the 404 page, and none of those renders an article body; these rules would
 * be dead weight on all three. Registered with article.css as a dependency so
 * source order is guaranteed: `.vb-article__body a` is (0,1,1) and so is
 * `.vb-note a`, so whichever sheet loads last wins. That is the same
 * specificity trap already commented at .vb-guide__ctabtn in article.css,
 * where the generic link colour beat the button and it measured 2.08:1.
 *
 * Three components, no more, because the corpus has content for three:
 *   .vb-note     four variants - danger, warn, do, fact
 *   .vb-steps    a sequence whose order carries information
 *   .vb-keyline  the one sentence per article worth lifting
 *
 * Nothing here animates. The severity of a callout is information, and motion
 * on it would be manufactured urgency, which docs/design-principles.md §1
 * rules out. The site-wide Calm view would strip it anyway.
 */

/* ---------------------------------------------------------------------------
   Notes: a lead-in and its list, marked for what they mean
   ---------------------------------------------------------------------------
   The block wraps the lead-in paragraph AND the list, never the list alone:
   42 of the corpus's 123 list items begin lowercase and are grammatical
   continuations of the sentence above them. Splitting them would leave a
   sentence fragment outside the box.

   Colour never carries the meaning on its own (WCAG 1.4.1, Level A). Every
   note opens with an authored visible label; the edge and the tint only
   reinforce it. Remove all colour and the reader still knows which is which.
   --------------------------------------------------------------------------- */

.vb-note {
	/* Variants redefine only these three. Body copy stays --vb-ink so it keeps
	   the reading colour of the article it sits in. */
	--note-edge: var(--vb-line, #d9c7c1);
	--note-fill: var(--vb-surface, #f2e7df);
	--note-label: var(--vb-ink, #30272b);

	max-width: var(--vb-measure);
	margin: 2em auto;
	padding: 16px 20px 18px;
	border: 1px solid var(--vb-line, #d9c7c1);
	border-left: 4px solid var(--note-edge);
	border-radius: 0 var(--vb-radius-sm, 11px) var(--vb-radius-sm, 11px) 0;
	background: var(--note-fill);
}

/* The article body sets `> * + *` margins; inside a note the block owns its
   own rhythm, or the first child inherits a top margin from the paragraph
   before the note. */
.vb-article__body .vb-note > * { margin-top: 0; }
.vb-article__body .vb-note > * + * { margin-top: 0.7em; }

.vb-note__label {
	display: flex;
	align-items: center;
	gap: 9px;
	font-family: var(--vb-display);
	font-weight: 600;
	font-size: var(--vb-text-body, 1rem);
	line-height: 1.35;
	color: var(--note-label);
}

/* The glyph is drawn, not written: WordPress kses has no `svg` element, so an
   inline <svg> in a post body is stripped the moment anything runs kses over
   it - which today only WP-CLI's own kses_remove_filters keeps from happening.
   A mask over `currentColor` also means the mark follows the label's token
   into the dark scheme with no second declaration. Decorative by
   construction: nothing here is exposed to a screen reader, and the label
   beside it carries the whole meaning. */
.vb-note--danger > .vb-note__label::before,
.vb-note--do > .vb-note__label::before,
.vb-note--fact > .vb-note__label::before {
	content: "";
	flex: none;
	width: 20px;
	height: 20px;
	background: currentColor;
	-webkit-mask: var(--note-glyph) center / contain no-repeat;
	mask: var(--note-glyph) center / contain no-repeat;
}
/* The glyph is opted INTO by the variants that have one. A base rule with
   `mask: none` would paint a solid 20px square of currentColor on the one
   variant that deliberately has no icon. */

/* :not(.vb-note__label) is load-bearing. `.vb-note p` is (0,1,1) and
   `.vb-note__label` is (0,1,0), so the body-copy rule wins and every label
   renders in reading ink - measured live on the danger box: rgb(10,42,31)
   where --vb-danger-ink #7c241a was intended. Colour is only the
   reinforcement here (the word carries the meaning), but a reinforcement that
   silently does nothing is worse than none. Third time this repo has lost a
   colour to a specificity tie or beat; see .vb-guide__ctabtn in article.css. */
.vb-note p:not(.vb-note__label),
.vb-note li { color: var(--vb-ink, #30272b); }

.vb-note ul,
.vb-note ol { padding-left: 1.2em; }
.vb-note li + li { margin-top: 0.45em; }
/* Qualified, not bare. `.vb-article__body li::marker` (article.css:132) paints
   markers green and is (0,1,2); a bare `.vb-note li::marker` is (0,1,2) too, so
   only source order would decide - and this repo has already lost a colour to
   exactly that tie. The dependency makes this sheet load second, but a tie that
   depends on load order is a trap for whoever splits a stylesheet next. */
.vb-article__body .vb-note li::marker { color: var(--note-edge); }

/* --- danger: the consequence is time-critical ---------------------------- */
.vb-note--danger {
	--note-edge: var(--vb-danger-text, #b52216);
	--note-fill: var(--vb-danger-soft, #ffece6);
	--note-label: var(--vb-danger-ink, #b52216);
	--note-glyph: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M8 16v-4a4 4 0 0 1 8 0v4%22 /%3E%3Cpath d=%22M3 12h1m8 -9v1m8 8h1m-15.4 -6.4l.7 .7m12.1 -.7l-.7 .7%22 /%3E%3Cpath d=%22M6 17a1 1 0 0 1 1 -1h10a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-10a1 1 0 0 1 -1 -1l0 -2%22 /%3E%3C/svg%3E");
	border-color: var(--vb-danger-text, #b52216);
}
/* The one place the whole edge is coloured rather than just the left rule.
   Measured: --vb-danger-ink on --vb-danger-soft is 8.95:1 light, 9.01:1 dark. */

/* --- warn: what a well-meaning owner does that makes it worse ------------- */
.vb-note--warn {
	--note-edge: var(--vb-warn-text, #86520a);
	--note-fill: var(--vb-warn-soft, #fff0d8);
	--note-label: var(--vb-warn-ink, #86520a);
	/* No glyph. None of the 22 vendored icons means "refrain from this", and
	   inventing one for a single variant would fork the icon set. The label
	   and the amber edge carry it. */
}

/* --- do: what to bring, what to have ready ------------------------------- */
.vb-note--do {
	--note-edge: var(--vb-accent-text, #68192e);
	--note-fill: var(--vb-primary-soft, #f3e2e7);
	--note-label: var(--vb-success-ink, #176849);
	--note-glyph: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M11.5 21h-5.5a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v6%22 /%3E%3Cpath d=%22M16 3v4%22 /%3E%3Cpath d=%22M8 3v4%22 /%3E%3Cpath d=%22M4 11h16%22 /%3E%3Cpath d=%22M15 19l2 2l4 -4%22 /%3E%3C/svg%3E");
}

/* --- fact: a statutory duty or deadline ---------------------------------- */
.vb-note--fact {
	--note-edge: var(--vb-gold, #e0a82e);
	--note-fill: var(--vb-tint-warm, #fbf7f2);
	--note-label: var(--vb-warn-ink, #86520a);
	--note-glyph: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0%22 /%3E%3Cpath d=%22M12 7v5l3 3%22 /%3E%3C/svg%3E");
}
/* --vb-tint-warm flips to #241d10 under [data-theme="dark"]; --vb-warn-ink
   flips with it. Checked as a pair, not one at a time. */

/* ---------------------------------------------------------------------------
   Steps: an order that carries information
   ---------------------------------------------------------------------------
   Only where the sequence is the point. The corpus says so in its own words at
   the two places this first ships: "gilt eine einfache Reihenfolge" and "ist
   die Reihenfolge fest". A list whose order does not matter stays a <ul>.
   --------------------------------------------------------------------------- */

.vb-steps {
	max-width: var(--vb-measure);
	margin: 1.6em auto;
	padding: 0;
	list-style: none;
	counter-reset: vb-step;
}

.vb-steps > li {
	position: relative;
	counter-increment: vb-step;
	padding: 0 0 1.15em 44px;
}

.vb-steps > li::before {
	content: counter(vb-step);
	position: absolute;
	left: 0;
	top: -1px;
	width: 28px;
	height: 28px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--vb-primary-soft, #f3e2e7);
	color: var(--vb-accent-text, #68192e);
	font-family: var(--vb-display);
	font-weight: 700;
	font-size: var(--vb-text-small, 0.85rem);
	font-variant-numeric: tabular-nums;
}

/* The rail between the markers. Drawn on the item rather than as a border on
   the list so the last step does not trail a line into white space. */
.vb-steps > li:not(:last-child)::after {
	content: "";
	position: absolute;
	left: 13px;
	top: 30px;
	bottom: 2px;
	width: 2px;
	background: var(--vb-line, #d9c7c1);
}

.vb-steps > li + li { margin-top: 0; }

/* ---------------------------------------------------------------------------
   Keyline: the one sentence in an article worth slowing down for
   ---------------------------------------------------------------------------
   No fill and no colour of its own, on purpose. It is emphasis, not severity,
   and a fifth tinted panel would blunt the four that mean something. At most
   one per article.
   --------------------------------------------------------------------------- */

.vb-keyline {
	max-width: var(--vb-measure);
	margin: 1.8em auto;
	padding: 2px 0 2px 20px;
	border-left: 3px solid var(--vb-primary, #b66a80);
	font-size: 1.1rem;
	line-height: 1.55;
	color: var(--vb-ink, #30272b);
}

.vb-keyline p { margin: 0; }

/* ---------------------------------------------------------------------------
   Narrow screens
   --------------------------------------------------------------------------- */

@media (max-width: 39.99rem) {
	.vb-note { padding: 14px 16px 16px; }
	.vb-note__label { font-size: var(--vb-text-body, 1rem); }
	.vb-steps > li { padding-left: 38px; }
	.vb-steps > li::before { width: 25px; height: 25px; font-size: var(--vb-text-caption, 0.78rem); }
	.vb-steps > li:not(:last-child)::after { left: 11.5px; top: 27px; }
	.vb-keyline { padding-left: 15px; font-size: var(--vb-text-lead, 1.0625rem); }
}

/* ---------------------------------------------------------------------------
   Read on: the articles this one points to
   ---------------------------------------------------------------------------
   Before this existed the corpus had ZERO links between its own articles -
   `grep -c href data/guides.php` returned 0 across fourteen articles and four
   languages. A reader whose question was answered next door had to go back to
   the index to find out.

   A named <nav>, like the table of contents above it. Named matters: the
   research measured 112 unnamed complementary landmarks already shipping
   across the corpus, and an unnamed second nav per article would add to that.
   --------------------------------------------------------------------------- */

.vb-guide__related {
	max-width: var(--vb-measure);
	margin: 2.4em auto 0;
	padding: 18px 20px;
	border: 1px solid var(--vb-line, #d9c7c1);
	border-radius: var(--vb-radius-sm, 11px);
	background: var(--vb-surface, #f2e7df);
}

.vb-guide__related-title {
	margin: 0 0 10px;
	font-family: var(--vb-display);
	font-size: var(--vb-text-caption, 0.78rem);
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--vb-muted, #6b5b60);
}

.vb-guide__related ul {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.vb-guide__related a {
	display: block;
	/* 40px, the target size the rest of the site was measured to (M-070).
	   These are navigation links, not links inside a sentence, so the
	   running-text exception does not apply to them. */
	min-height: 40px;
	padding: 9px 0;
	box-sizing: border-box;
	font-weight: 600;
	line-height: 1.4;
	color: var(--vb-accent-text, #68192e);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.vb-guide__related li + li a { border-top: 1px solid var(--vb-line, #d9c7c1); }

/* ---------------------------------------------------------------------------
   Figures
   ---------------------------------------------------------------------------
   The body carries an empty <figure> and its caption; the engine puts the
   drawing inside it (WordPress kses has no `svg` element, so a hand-authored
   one would be stripped). The caption is the text alternative, which is why it
   is authored per language and the drawing is not.
   --------------------------------------------------------------------------- */

.vb-figure {
	max-width: var(--vb-measure);
	margin: 2em auto;
	padding: 0;
	border: 1px solid var(--vb-line, #d9c7c1);
	border-radius: var(--vb-radius-sm, 11px);
	background: var(--vb-surface, #f2e7df);
	overflow: hidden;
}

.vb-figure__svg {
	display: block;
	width: 100%;
	height: auto;
	/* The drawings carry their own words, and they inherit the reading face
	   rather than the display one: a label inside a diagram is read, not
	   looked at. */
	font-family: inherit;
}

.vb-figure figcaption {
	margin: 0;
	padding: 12px 16px 14px;
	border-top: 1px solid var(--vb-line, #d9c7c1);
	background: var(--vb-base, #fbf7f2);
	color: var(--vb-muted, #6b5b60);
	font-size: var(--vb-text-label, 0.9rem);
	line-height: 1.55;
}
