/* ── Docs sidebar layout ────────────────────────────────────────── */

.docs-layout-wrapper {
	display: flex;
	flex-direction: row;
	gap: var(--spacer-five);
	padding-top: var(--spacer-five);
	padding-bottom: 80px;
	align-items: flex-start;
	margin: 0 auto;
}

.docs-sidebar {
	width: 200px;
	flex-shrink: 0;
	position: sticky;
	top: 24px;
}

.docs-main {
	flex: 1;
	min-width: 0;
}

.docs-sidebar nav ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.docs-sidebar-group {
	margin-top: 32px;
	margin-bottom: 20px;
}

/* First group (Overview / Components) needs no top margin */
.docs-sidebar-group:first-child {
	margin-top: 0;
}

.docs-sidebar-group-label {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #999;
	margin-bottom: 6px;
	padding-left: 8px;
}

/* Transparent left border on all links prevents layout shift on active */
.docs-sidebar nav a {
	display: block;
	padding: 4px 6px 4px 6px;
	color: inherit;
	text-decoration: none;
	border-radius: 4px;
	font-size: 0.9rem;
	border-left: 2px solid transparent;
	transition:
		background 0.1s ease-out,
		color 0.1s ease-out;
}

.docs-sidebar nav a:hover {
	background: rgba(0, 0, 0, 0.05);
}

.docs-sidebar nav a.active {
	font-weight: 600;
	background: rgba(39, 154, 225, 0.08);
	border-left-color: var(--blue-one-colour);
	color: var(--blue-one-colour);
}

@media screen and (prefers-color-scheme: dark) {
	.docs-sidebar-group-label {
		color: #666;
	}

	.docs-sidebar nav a:hover {
		background: rgba(255, 255, 255, 0.08);
	}

	.docs-sidebar nav a.active {
		background: rgba(39, 154, 225, 0.12);
		color: var(--blue-two-colour);
		border-left-color: var(--blue-two-colour);
	}
}

@media screen and (max-width: 768px) {
	.docs-layout-wrapper {
		flex-direction: column;
		gap: var(--spacer-three);
		padding-top: var(--spacer-three);
	}

	.docs-sidebar {
		width: 100%;
		position: static;
	}
}

/* ── Component page content ─────────────────────────────────────── */

.docs-content h1 {
	margin-bottom: 1rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid var(--form-field-border-colour);
}

.docs-content h2 {
	margin-top: 2.5rem;
	margin-bottom: 0.75rem;
}

/* Prevent the broad h2 rule from bleeding into components that control
   their own heading styles (e.g. Modal, Popover, Card). */
.docs-content dialog h2,
.docs-content .popover h2,
.docs-content .card h2 {
	margin-top: 0;
	margin-bottom: 0;
}

/* Cap line length on prose for comfortable reading */
.docs-content p,
.docs-content li {
	max-width: 72ch;
	line-height: 1.6;
	margin-bottom: 1rem;
}

/* Muted lead paragraph immediately after the page title */
.docs-content h1 + p {
	font-size: 1.05rem;
	color: #555;
	line-height: 1.7;
	margin-bottom: 1.5rem;
}

/* Inline code badge */
.docs-content code {
	background: rgba(0, 0, 0, 0.06);
	border: 1px solid rgba(0, 0, 0, 0.09);
	padding: 2px 6px;
	border-radius: 4px;
	font-family: "Menlo", "Monaco", "Courier New", monospace;
	font-size: 10pt;
}

@media screen and (prefers-color-scheme: dark) {
	.docs-content h1 {
		border-bottom-color: rgba(255, 255, 255, 0.12);
	}

	.docs-content h1 + p {
		color: #aaa;
	}

	.docs-content code {
		background: rgba(255, 255, 255, 0.08);
		border-color: rgba(255, 255, 255, 0.12);
	}
}

/* Live example box */
.docs-example {
	position: relative;
	margin-top: 2rem;
	padding: 1.5rem;
	background: rgba(39, 154, 225, 0.03);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
}

/* Floating "Example" label centred on the top border */
.docs-example::before {
	content: "Example";
	position: absolute;
	top: 0;
	left: var(--spacer-two);
	transform: translateY(-50%);
	background: var(--light);
	padding: 2px 8px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #aaa;
	border-radius: 4px;
}

@media screen and (prefers-color-scheme: dark) {
	.docs-example {
		background: rgba(39, 154, 225, 0.04);
		border-color: rgba(255, 255, 255, 0.1);
	}

	.docs-example::before {
		background: var(--dark);
		color: #555;
	}
}

.docs-component-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--spacer-two);
	margin-bottom: 2rem;
}

@media screen and (max-width: 768px) {
	.docs-component-grid {
		grid-template-columns: 1fr;
	}
}

/* ── Docs index (overview) page ─────────────────────────────────── */

.docs-index-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--spacer-two);
	margin-top: 1.5rem;
}

@media screen and (min-width: 1025px) {
	.docs-index-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media screen and (max-width: 768px) {
	.docs-index-grid {
		grid-template-columns: 1fr;
	}
}

.docs-index-card-link {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	border-radius: 8px;
	transition:
		box-shadow 0.2s,
		transform 0.15s;
}

.docs-index-card-link .card {
	flex: 1;
}

.docs-index-card-link:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	transform: translateY(-2px);
}

.docs-index-card-disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.docs-index-badge {
	display: inline-block;
	padding: 0.15rem 0.5rem;
	border-radius: 99px;
	font-size: 0.75rem;
	font-weight: 600;
	background: rgba(0, 0, 0, 0.08);
	color: inherit;
}

@media screen and (prefers-color-scheme: dark) {
	.docs-index-card-link:hover {
		box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
	}

	.docs-index-badge {
		background: rgba(255, 255, 255, 0.1);
	}
}

/* ── Grid spacer visualiser ─────────────────────────────────────── */

.grid-spacer-list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.grid-spacer-row {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.grid-spacer-label {
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 160px;
	flex-shrink: 0;
}

.grid-spacer-label code {
	font-size: 0.8rem;
}

.grid-spacer-px {
	font-size: 0.75rem;
	color: #888;
	font-family: monospace;
}

.grid-spacer-bar {
	height: 20px;
	background: var(--blue-one-colour);
	border-radius: 3px;
	flex-shrink: 0;
}

.grid-spacer-name {
	font-size: 0.8rem;
	color: #888;
}

@media screen and (prefers-color-scheme: dark) {
	.grid-spacer-px,
	.grid-spacer-name {
		color: #666;
	}
}

/* ── Typography scale ────────────────────────────────────────────── */

.typography-scale {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	margin-bottom: 1.5rem;
	padding: 1.5rem;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
}

@media screen and (prefers-color-scheme: dark) {
	.typography-scale {
		border-color: rgba(255, 255, 255, 0.1);
	}
}

.typography-scale-row {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding-bottom: 1.25rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.typography-scale-row:last-child {
	padding-bottom: 0;
	border-bottom: none;
}

@media screen and (prefers-color-scheme: dark) {
	.typography-scale-row {
		border-color: rgba(255, 255, 255, 0.06);
	}
}

.typography-scale-meta {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.78rem;
	color: #888;
	margin-bottom: 0.25rem;
}

/* Reset badge styling inside the typography meta row */
.typography-scale-meta code {
	background: none;
	border: none;
	padding: 0;
}

.typography-samples {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.typography-sample {
	padding: 1rem 1.25rem;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
}

@media screen and (prefers-color-scheme: dark) {
	.typography-sample {
		border-color: rgba(255, 255, 255, 0.1);
	}
}

.typography-sample-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-bottom: 0.6rem;
	font-size: 0.8rem;
	color: #888;
}

.typography-sample-meta strong {
	color: inherit;
}

@media screen and (prefers-color-scheme: dark) {
	.typography-scale-meta,
	.typography-sample-meta {
		color: #666;
	}
}

/* ── Colour swatches ─────────────────────────────────────────────── */

.colour-swatch-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--spacer-two);
	margin-bottom: 2rem;
}

@media screen and (max-width: 768px) {
	.colour-swatch-grid {
		grid-template-columns: 1fr 1fr;
	}
}

.colour-swatch-meta {
	padding: 0.5rem 0;
}

/* Reset badge styling inside colour swatches */
.colour-swatch-meta code {
	display: block;
	font-size: 0.8rem;
	margin-bottom: 0.25rem;
	background: none;
	border: none;
	padding: 0;
	color: inherit;
}

.colour-swatch-meta p {
	font-size: 0.8rem;
	color: #666;
	margin: 0;
	line-height: 1.4;
}

@media screen and (prefers-color-scheme: dark) {
	.colour-swatch-meta p {
		color: #999;
	}
}

/* ── Component overview grid ─────────────────────────────────────── */

.docs-component-card-wrapper {
	display: flex;
	flex-direction: column;
}

.docs-component-card-wrapper .card {
	flex: 1;
}

.docs-component-card-wrapper .card-image {
	height: 140px;
	object-fit: contain;
	object-position: center center;
	background-color: white;
}

.docs-component-card-wrapper .card-body {
	font-size: 0.85rem;
	color: #555;
}

.docs-card-actions {
	display: flex;
	gap: 0.5rem;
}

.docs-card-action {
	display: inline-flex;
	align-items: center;
	padding: 0.3rem 0.75rem;
	border-radius: 4px;
	font-size: 0.8rem;
	font-weight: 600;
	text-decoration: none;
	transition: background 0.15s;
}

.docs-card-action-docs {
	background: var(--primary-colour);
	color: #fff;
	border: 1px solid var(--primary-colour);
}

.docs-card-action-docs:hover {
	background-color: transparent;
	color: var(--primary-colour);
	border: 1px solid var(--primary-colour);
}

.docs-card-action-preview {
	background: var(--secondary-colour);
	color: #fff;
	border: 1px solid var(--secondary-colour);
}

.docs-card-action-preview:hover {
	background-color: transparent;
	color: var(--secondary-colour);
	border: 1px solid var(--secondary-colour);
}

@media screen and (prefers-color-scheme: dark) {
	.docs-component-card-wrapper .card-body {
		color: #aaa;
	}

	.docs-card-action-docs {
		color: var(--dark);
	}

	.docs-card-action-docs:hover {
		background: var(--blue-one-colour);
		color: #fff;
	}
}

/* ── Prop table ─────────────────────────────────────────────────── */

.prop-table {
	width: 100%;
	border-collapse: collapse;
	margin: 0.5rem 0 1.5rem;
	font-size: 0.875rem;
}

.prop-table th {
	text-align: left;
	padding: 0.4rem 0.75rem;
	border-bottom: 2px solid rgba(0, 0, 0, 0.15);
	font-weight: 700;
}

.prop-table td {
	padding: 0.35rem 0.75rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	vertical-align: top;
}

/* Prop name column — inherits badge styling from .docs-content code */
.prop-table td:first-child code {
	font-size: 0.82rem;
}

/* Type column — monospace, muted */
.prop-table td:nth-child(2) {
	font-family: "Menlo", "Monaco", "Courier New", monospace;
	font-size: 0.8rem;
	color: #666;
}

@media screen and (prefers-color-scheme: dark) {
	.prop-table th {
		border-color: rgba(255, 255, 255, 0.2);
	}

	.prop-table td {
		border-color: rgba(255, 255, 255, 0.06);
	}

	.prop-table td:nth-child(2) {
		color: #999;
	}
}

/* ── Colour key swatches (overview usage) ────────────────────────── */

.colour-key {
	width: 96px;
	height: 96px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-weight: bold;
	text-align: center;
}

.colour-key.primary {
	background: var(--primary-colour);
}

.colour-key.secondary {
	background: var(--secondary-colour);
}

.colour-key.tertiary {
	background: var(--tertiary-colour);
}

.colour-key.green-two {
	background: var(--green-two-colour);
}

.colour-key.green-one {
	background: var(--green-one-colour);
}

.colour-key.blue-two {
	background: var(--blue-two-colour);
}

.colour-key.blue-one {
	background: var(--blue-one-colour);
}
