/* ==========================================================================
   Reusable Demo Styles
   ========================================================================== */

/* Base Layout
   ========================================================================== */

:root {
  color-scheme: light dark;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
		Oxygen, Ubuntu, Cantarell, sans-serif;
	line-height: 1.6;
	color: CanvasText;
	background: Canvas;
	max-width: 1400px;
	margin: 0 auto;
	padding: 1rem;
}

.visibly-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

/* Typography
   ========================================================================== */

h1 {
	font-size: 2rem;
	margin-block: 0 0.5rem;
}

h2 {
	font-size: 1.5rem;
	margin-block: 2rem 1rem;
	border-bottom: 2px solid;
	padding-bottom: 0.5rem;
}

h3 {
	font-size: 1.25rem;
	margin-block: 1.5rem 0.5rem;
}

p {
	margin-block: 0.5rem;
}

code {
	background-color: ButtonFace;
	color: ButtonText;
	padding: 0.125rem 0.25rem;
	border-radius: 3px;
	font-family: 'Courier New', Courier, monospace;
	font-size: 0.9em;
}

/* Links
   ========================================================================== */

a {
	color: LinkText;
	text-decoration-skip-ink: auto;
}

a:visited {
	color: VisitedText;
}

a:active {
	color: ActiveText;
}

a:hover {
	text-decoration: underline;
}

/* Header & Footer
   ========================================================================== */

header {
	margin-block-end: 2rem;
}

header p {
	font-size: 1.1rem;
}

footer {
	margin-block-start: 3rem;
	padding-block-start: 2rem;
	border-top: 2px solid ButtonBorder;
	color: GrayText;
	font-size: 0.9rem;
}

/* Demo Sections
   ========================================================================== */

.demo-section {
	margin-block: 2rem;
	padding: 1.5rem;
	background: ButtonFace;
	border-radius: 8px;
	border: 1px solid ButtonBorder;
}

.demo-section > p {
	color: CanvasText;
	margin-block-end: 1rem;
}

/* Code & Demo Pairing
   ========================================================================== */

.code-demo-pair {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-block: 1rem;
}

@media (min-width: 768px) {
	.code-demo-pair {
		flex-direction: row;
		align-items: flex-start;
	}

	.code-demo-pair > pre {
		flex: 1;
		margin: 0;
	}

	.code-demo-pair > .demo {
		flex: 1;
	}
}

/* Code Blocks
   ========================================================================== */

pre {
	background: Field;
	color: FieldText;
	padding: 1rem;
	border-radius: 6px;
	overflow-x: auto;
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.3;
}

pre code {
	background: none;
	padding: 0;
	color: inherit;
	font-size: inherit;
}

pre code mark {
	background: Mark;
	color: MarkText;
	border-radius: 2px;
	padding: 0.125rem 0.25rem;
	font-weight: 600;
}

/* Demo Container
   ========================================================================== */

.demo {
	background: Canvas;
	padding: 1rem;
	border-radius: 6px;
	border: 1px solid ButtonBorder;
}

/* Form Elements
   ========================================================================== */

legend,
label {
	font-weight: bold;
	display: block;
	margin-block: 1rem;
}

label:has(+ input),
label:has(+ select),
label:has(+ textarea) {
	margin-block-end: 0;
}

fieldset {
	margin-block: 1rem;
	border: 0;
	padding: 0;
}

legend {
	margin-block: 0;
	padding: 0;
}

fieldset > label {
	font-weight: normal;
	margin-block: 0.25rem;
	min-height: 23px;
}

input:not([type='checkbox'], [type='radio'], [type='submit'], [type='reset']),
select,
textarea {
	display: block;
	padding: 0.25rem 0.5rem;
	border: 1px solid ButtonBorder;
	border-radius: 4px;
	font-size: 1rem;
	font-family: inherit;
	width: 100%;
	max-width: 400px;
	background: Field;
	color: FieldText;
}

:focus-visible {
	outline: 2px solid AccentColor;
	outline-offset: 2px;
	border-color: AccentColor;
}

button[type='submit'],
button[type='reset'] {
	background: ButtonFace;
	color: ButtonText;
	border: 1px solid ButtonBorder;
	padding: 0.75rem 1.5rem;
	border-radius: 4px;
	font-size: 1rem;
	font-weight: bold;
	cursor: pointer;
	margin-block-start: 1rem;
	margin-inline-end: 0.5rem;
}

button[type='submit']:hover,
button[type='reset']:hover {
	opacity: 0.8;
}

small {
	display: block;
	font-style: italic;
	font-weight: normal;
	margin-block: 0.5rem 1rem;
	color: GrayText;
}

/* Radio/Checkbox "Other" Pattern
   ========================================================================== */

.other-radio,
.other-checkbox {
	display: flex;
	margin-block: 0.25rem;
	min-height: 23px;
	align-items: flex-start;
}

.other-radio label,
.other-checkbox label {
	font-weight: normal;
	margin-block: 0;
	margin-inline-end: 0.5rem;
}

.other-radio label + *,
.other-checkbox label + * {
	flex: 1;
}

/* Note Boxes
   ========================================================================== */

.note {
	background: Mark;
	color: MarkText;
	border-left: 4px solid AccentColor;
	padding: 1rem;
	margin-block: 1rem;
	border-radius: 4px;
}

.note strong {
	display: block;
	margin-block-end: 0.5rem;
}

/* API Reference Box
   ========================================================================== */

.api-reference {
	background: SelectedItem;
	color: SelectedItemText;
	border-left: 4px solid AccentColor;
	padding: 1rem;
	margin-block: 2rem;
	border-radius: 4px;
}

.api-reference p {
	margin: 0;
}

.api-reference a {
  color: inherit;
}
