/* Component gallery (/_dev/components, web/routes/dev_components.py).
   Development and demo only. Places specimens; the components paint
   themselves, and every colour here comes from the surface set. */

@layer layout {
	.component-gallery {
		display: flex;
		flex-direction: column;
		gap: var(--t-space-5);
		padding: var(--t-space-4);

		& header, & section {
			padding: var(--t-space-5);
			border-radius: var(--t-radius-lg);
		}

		& nav ul {
			display: flex;
			flex-wrap: wrap;
			gap: var(--t-space-2) var(--t-space-4);
			padding: 0;
			margin: var(--t-space-2) 0 0;
			list-style: none;
		}

		& nav a[aria-current="page"] {
			font-weight: var(--t-font-weight-bold);
		}

		& .specimens {
			display: grid;
			grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
			gap: var(--t-space-4);
			margin-block-start: var(--t-space-3);

			&.wide {
				grid-template-columns: 1fr;
			}

			/* Whole forms: a 14rem column would squeeze a text input to nothing. */
			&.forms {
				grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
				align-items: start;
			}
		}

		/* A mark takes its size from the page it sits on; this is the
		   gallery's. */
		& .mark-specimens .mark {
			margin: 0;
			inline-size: 3rem;
			block-size: 3rem;

			& svg {
				inline-size: 1.75rem;
				block-size: 1.75rem;
			}
		}

		& .specimen {
			display: flex;
			flex-direction: column;
			gap: var(--t-space-2);
			margin: 0;
		}

		& .specimen figcaption {
			display: flex;
			flex-direction: column;
			font-size: var(--t-font-size-xs);

			& .name {
				font-weight: var(--t-font-weight-semibold);
			}
		}

		& .swatch {
			padding: var(--t-space-3);
			border-radius: var(--t-radius-md);

			& .swatch {
				margin-block-start: var(--t-space-2);
			}
		}

		& .ink {
			margin: 0;
			font-size: var(--t-font-size-sm);

			&.border {
				padding: var(--t-space-1) var(--t-space-2);
				margin-block-start: var(--t-space-1);
				border-width: var(--t-border-width-interactive);
				border-radius: var(--t-radius-md);
			}
		}
	}
}

@layer design {
	.component-gallery {
		& .specimen figcaption {
			color: var(--c-surface-text-color-muted);
		}

		& nav a {
			color: var(--c-surface-text-color-interactive);
		}

		& .ink {
			&.base { color: var(--c-surface-text-color-base); }
			&.muted { color: var(--c-surface-text-color-muted); }
			&.highlight { color: var(--c-surface-text-color-highlight); }
			&.interactive { color: var(--c-surface-text-color-interactive); }
			&.info { color: var(--c-surface-text-color-info); }
			&.error { color: var(--c-surface-text-color-error); }
			&.success { color: var(--c-surface-text-color-success); }
			&.warning { color: var(--c-surface-text-color-warning); }

			&.border {
				border-style: solid;
				border-color: var(--c-surface-border-color-interactive);
			}
		}
	}
}
