/**
 * Style Guide — nur das Gerüst.
 *
 * Alles, was die Seite zeigt (Buttons, Prose, Sections, Formulare), kommt aus
 * base.css. Hier stehen ausschliesslich die Rahmen drumherum: Raster für die
 * Farbfelder, Beschriftungen, Trennlinien. Nichts davon gehört in base.css —
 * es kommt auf keiner anderen Seite vor.
 */

.sg-block {
	padding-top: var(--space-xl);
	margin-top: var(--space-xl);
	border-top: 1px solid var(--color-border);
}

.sg-block:first-child {
	padding-top: 0;
	margin-top: 0;
	border-top: 0;
}

.sg-group {
	margin-bottom: var(--space-l);
}

.sg-group:last-child {
	margin-bottom: 0;
}

.sg-group__title {
	margin-bottom: var(--space-xs);
	font-family: var(--font-body);
	font-size: var(--text-sm);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-muted);
}

/* Die Erklärung neben einem Muster — nie das Muster selbst. */
.sg-note {
	max-width: 68ch;
	margin-bottom: var(--space-s);
	color: var(--color-muted);
	font-size: var(--text-sm);
}

.sg-note--dark {
	margin-top: var(--space-s);
	margin-bottom: 0;
}

/*
 * Der Kasten um eine Demo. Übernimmt --section-bg und --section-color von
 * .section, damit sich .section--bg-dark und Geschwister direkt daraufsetzen
 * lassen — die Farbumschaltung steckt in den Klassen, den Grund malt sonst
 * aber nur .section selbst.
 */
.sg-demo {
	padding: var(--space-m);
	background-color: var(--section-bg, transparent);
	color: var(--section-color, inherit);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-m);
}

.sg-demo + .sg-demo {
	margin-top: var(--space-s);
}

.sg-demo > :last-child {
	margin-bottom: 0;
}

/* Auf farbigem Grund ist der graue Rahmen nur Störung. */
.sg-demo--dark,
.sg-demo--accent {
	border-color: transparent;
}

.sg-cols,
.sg-sections {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
	gap: var(--space-s);
	align-items: start;
}

.sg-cols .sg-demo + .sg-demo,
.sg-sections .sg-demo + .sg-demo {
	margin-top: 0;
}

/* ------------------------------------------------------------- Farbfelder */

.sg-swatches,
.sg-fonts,
.sg-sizes,
.sg-leadings,
.sg-spaces,
.sg-radii,
.sg-shadows,
.sg-legend,
.sg-plain-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sg-swatches {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
	gap: var(--space-s);
}

.sg-swatch__chip {
	display: block;
	height: 3.5rem;
	margin-bottom: var(--space-2xs);
	border-radius: var(--radius-s);
	/*
	 * Der Rahmen ist nicht Dekor: --color-bg ist Weiss und hätte auf der
	 * weissen Seite sonst keine Kante.
	 */
	box-shadow: inset 0 0 0 1px var(--color-border-light);
}

/* Dunkle Felder brauchen die helle Kante, die dunkle sähe man nicht. */
.sg-swatch__chip--dark {
	box-shadow: inset 0 0 0 1px rgb(255 255 255 / 25%);
}

/*
 * Der Klassen- bzw. Tokenname. Bewusst dieselbe Optik wie ein <code> in
 * .prose, damit sich beides auf der Seite gleich liest.
 */
.sg-swatch__token,
.sg-value {
	display: inline-block;
	padding: 0.15em 0.4em;
	background: var(--color-surface);
	border-radius: var(--radius-s);
	font-family: var(--font-mono);
	font-size: var(--text-xs);
	color: var(--color-text);
}

.sg-value {
	color: var(--color-muted);
}

/* Ohne JavaScript bleibt das Element leer — dann auch ohne Kasten. */
.sg-value:empty {
	display: none;
}

.sg-swatch__label {
	display: block;
	margin-top: var(--space-3xs);
	color: var(--color-muted);
	font-size: var(--text-sm);
	line-height: var(--leading-snug);
}

/* ------------------------------------------------------------ Typografie */

.sg-fonts {
	display: grid;
	gap: var(--space-m);
}

.sg-font-sample {
	margin: var(--space-3xs) 0 0;
	font-size: var(--text-2xl);
	line-height: var(--leading-tight);
}

.sg-font-sample--heading { font-family: var(--font-heading); }
.sg-font-sample--body    { font-family: var(--font-body); }
.sg-font-sample--mono    { font-family: var(--font-mono); }

.sg-sizes {
	display: grid;
	gap: var(--space-m);
}

.sg-size__sample {
	margin: 0 0 var(--space-3xs);
	font-family: var(--font-heading);
	line-height: var(--leading-tight);
}

.sg-leadings {
	display: grid;
	gap: var(--space-m);
}

.sg-leadings p {
	max-width: 46ch;
	margin: var(--space-3xs) 0 0;
}

/* Überschriften direkt untereinander, ohne den Sog der Prose-Abstände. */
.sg-group--stack > * {
	margin-bottom: var(--space-s);
}

.sg-group--stack > :last-child {
	margin-bottom: 0;
}

/* ------------------------------------------------------ Abstände & Formen */

.sg-spaces {
	display: grid;
	gap: var(--space-2xs);
}

.sg-space {
	display: flex;
	align-items: center;
	gap: var(--space-2xs);
}

.sg-space__bar {
	height: 0.75rem;
	background: var(--color-brand);
	border-radius: var(--radius-s);
}

.sg-radii {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-m);
}

.sg-radii li {
	width: 9rem;
}

.sg-radius {
	display: block;
	height: 4rem;
	margin-bottom: var(--space-2xs);
	background: var(--color-surface-strong);
}

.sg-shadows {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-l);
	padding: var(--space-2xs) 0 var(--space-s);
}

.sg-shadow {
	display: grid;
	place-items: center;
	width: 11rem;
	height: 5rem;
	background: var(--color-bg);
	border-radius: var(--radius-m);
}

/* ------------------------------------------------------------- Aufzählung */

.sg-legend {
	display: grid;
	gap: var(--space-3xs);
	margin-top: var(--space-s);
	color: var(--color-muted);
	font-size: var(--text-sm);
}

.sg-plain-list {
	display: grid;
	gap: var(--space-3xs);
}

.sg-buttons {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-s);
}

.sg-label {
	display: block;
	margin-bottom: var(--space-3xs);
	font-size: var(--text-sm);
	font-weight: 600;
}
