.style-guide-page {
	background: var(--paper);
}

.sg-shell {
	display: grid;
	grid-template-columns: 270px minmax(0, 1fr);
	min-height: 100vh;
}

.sg-rail {
	background: var(--paper-soft);
	border-right: 1px solid var(--ink);
	display: flex;
	flex-direction: column;
	gap: 1.4rem;
	height: 100vh;
	overflow: auto;
	padding: 1.25rem;
	position: sticky;
	top: 0;
}

.sg-logo img {
	width: min(220px, 100%);
}

.sg-rail nav,
.sg-rail-actions {
	border-top: 1px solid var(--line);
	display: grid;
	gap: 0.1rem;
	padding-top: 1rem;
}

.sg-rail nav a,
.sg-rail-actions a {
	border-bottom: 1px solid transparent;
	justify-self: start;
	padding: 0.38rem 0;
	text-decoration: none;
}

.sg-rail nav a:hover,
.sg-rail nav a:focus-visible,
.sg-rail-actions a:hover,
.sg-rail-actions a:focus-visible {
	border-color: currentColor;
}

.sg-rail-actions {
	margin-top: auto;
}

.sg-main {
	min-width: 0;
}

.sg-hero {
	background: var(--ink);
	color: var(--paper-soft);
	display: grid;
	gap: clamp(1.5rem, 5vw, 4rem);
	grid-template-columns: minmax(0, 1fr) minmax(280px, 0.48fr);
	min-height: 72vh;
	padding: clamp(3rem, 8vw, 7rem) clamp(1.25rem, 6vw, 5rem) clamp(2rem, 5vw, 4rem);
	position: relative;
}

.sg-hero::before {
	background:
		linear-gradient(90deg, rgba(17, 17, 17, 0.86), rgba(17, 17, 17, 0.24)),
		url("https://fargfabriken.se/wp-content/uploads/2025/12/att-sla-rotwebsite-header-1200x675.jpg") center / cover;
	content: "";
	inset: 0;
	opacity: 0.72;
	position: absolute;
}

.sg-hero > * {
	align-self: end;
	position: relative;
}

.sg-hero h1 {
	color: var(--paper-soft);
	font-size: clamp(4.2rem, 12vw, 11rem);
	max-width: 7ch;
}

.sg-hero-copy {
	border-top: 1px solid rgba(255, 250, 241, 0.36);
	display: grid;
	gap: 1.2rem;
	padding-top: 1.2rem;
}

.sg-hero-copy p {
	color: rgba(255, 250, 241, 0.82);
	font-size: clamp(1.1rem, 1.8vw, 1.5rem);
	line-height: 1.25;
}

.sg-actions {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
}

.sg-hero .button-primary {
	background: var(--paper-soft);
	color: var(--ink);
}

.sg-section {
	border-top: 1px solid var(--ink);
	padding: clamp(2.4rem, 5vw, 5rem) clamp(1.25rem, 6vw, 5rem);
	scroll-margin-top: 1rem;
}

.sg-section-head {
	align-items: end;
	display: grid;
	gap: 1rem;
	grid-template-columns: minmax(0, 1fr) minmax(260px, 0.44fr);
	margin-bottom: clamp(1.5rem, 4vw, 3rem);
}

.sg-section-head h2 {
	font-size: clamp(2.4rem, 6vw, 6.2rem);
	line-height: 0.88;
	max-width: 9ch;
}

.sg-section-head p {
	color: var(--muted);
	font-size: clamp(1rem, 1.4vw, 1.25rem);
	line-height: 1.35;
}

.sg-card-grid,
.sg-token-grid,
.sg-fact-grid {
	display: grid;
	gap: 1px;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	margin-bottom: 1.25rem;
}

.sg-tight {
	grid-template-columns: repeat(3, minmax(0, 1fr));
	margin-top: 1.25rem;
}

.sg-principle,
.sg-token-grid article,
.sg-fact-grid article,
.sg-map article {
	background: var(--paper-soft);
	min-height: 190px;
	outline: 1px solid var(--line);
	padding: 1rem;
}

.sg-principle span,
.sg-token-grid span,
.sg-fact-grid span {
	color: var(--muted);
	display: block;
	font-size: 0.78rem;
	font-weight: 700;
	margin-bottom: 1rem;
	text-transform: uppercase;
}

.sg-principle h3 {
	font-size: clamp(1.35rem, 2.4vw, 2.1rem);
	line-height: 1;
	margin-bottom: 0.7rem;
}

.sg-principle p,
.sg-token-grid p,
.sg-map span {
	color: var(--muted);
	line-height: 1.4;
}

.sg-note {
	background: var(--acid);
	border: 1px solid var(--ink);
	margin: 1.25rem 0 0;
	max-width: 62rem;
	padding: 1rem;
}

.sg-swatches {
	display: grid;
	gap: 1px;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	margin-bottom: 1.25rem;
}

.sg-swatch {
	background: var(--paper-soft);
	outline: 1px solid var(--line);
}

.sg-swatch div {
	border-bottom: 1px solid var(--line);
	height: 110px;
}

.sg-swatch p {
	font-size: 0.86rem;
	line-height: 1.35;
	padding: 0.8rem;
}

.sg-token-grid {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sg-token-grid strong,
.sg-fact-grid strong {
	display: block;
	font-size: clamp(1.35rem, 2.4vw, 2.2rem);
	font-weight: 400;
	line-height: 1;
	margin-bottom: 0.7rem;
}

.sg-type-scale {
	display: grid;
	gap: 0;
}

.sg-type-scale article {
	align-items: baseline;
	border-top: 1px solid var(--line);
	display: grid;
	gap: 1rem;
	grid-template-columns: minmax(150px, 0.18fr) minmax(0, 1fr) minmax(160px, 0.2fr);
	padding: 1.05rem 0;
}

.sg-type-scale article > span,
.sg-type-scale code {
	color: var(--muted);
	font-size: 0.8rem;
}

.sg-type-scale code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.sg-display {
	font-family: var(--font-display);
	font-size: clamp(4rem, 9vw, 9rem);
	line-height: 0.86;
}

.sg-h2 {
	font-family: var(--font-heading);
	font-size: clamp(2rem, 4vw, 4.8rem);
	line-height: 1;
}

.sg-h3 {
	font-family: var(--font-heading);
	font-size: clamp(1.45rem, 2vw, 2.2rem);
	line-height: 1.08;
}

.sg-lead {
	color: var(--muted);
	font-size: clamp(1.05rem, 1.4vw, 1.35rem);
	max-width: 34rem;
}

.sg-meta {
	color: var(--muted);
	font-size: 0.78rem;
	text-transform: uppercase;
}

.sg-nav-preview {
	background: var(--paper-soft);
	border: 1px solid var(--ink);
}

.sg-nav-bar {
	align-items: center;
	border-bottom: 1px solid var(--ink);
	display: flex;
	gap: 2rem;
	justify-content: space-between;
	padding: 1rem;
}

.sg-nav-bar img {
	width: min(260px, 48vw);
}

.sg-nav-bar div {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	justify-content: flex-end;
}

.sg-nav-bar a {
	text-decoration: none;
}

.sg-mega-demo {
	display: grid;
	gap: clamp(1.25rem, 3vw, 2.5rem);
	grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.25fr) minmax(260px, 0.72fr);
	padding: clamp(1.25rem, 3vw, 2.6rem);
}

.sg-component-row {
	align-items: center;
	background: var(--paper-soft);
	display: flex;
	flex-wrap: wrap;
	gap: 0.8rem;
	margin-bottom: 1.25rem;
	outline: 1px solid var(--line);
	padding: 1rem;
}

.sg-program-demo {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sg-media-block {
	background: var(--paper-soft);
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 0.76fr);
	margin-bottom: 1.25rem;
	outline: 1px solid var(--line);
}

.sg-media-block img {
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.sg-media-block div {
	align-self: end;
	padding: clamp(1rem, 3vw, 2rem);
}

.sg-media-block h3 {
	font-size: clamp(2rem, 4vw, 4rem);
	line-height: 0.95;
	margin-bottom: 1rem;
}

.sg-media-block p:not(.eyebrow) {
	color: var(--muted);
	margin-bottom: 1rem;
	max-width: 32rem;
}

.sg-form-demo {
	max-width: 820px;
}

.sg-map {
	display: grid;
	gap: 1px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sg-map article {
	display: grid;
	gap: 0.7rem;
	min-height: 150px;
}

.sg-map strong {
	font-size: clamp(1.3rem, 2vw, 1.8rem);
	font-weight: 400;
	line-height: 1;
}

@media (max-width: 1100px) {
	.sg-shell {
		grid-template-columns: 1fr;
	}

	.sg-rail {
		border-bottom: 1px solid var(--ink);
		border-right: 0;
		height: auto;
		position: relative;
	}

	.sg-rail nav {
		grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	}

	.sg-section-head,
	.sg-hero,
	.sg-mega-demo,
	.sg-media-block {
		grid-template-columns: 1fr;
	}

	.sg-card-grid,
	.sg-token-grid,
	.sg-swatches,
	.sg-program-demo {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 680px) {
	.sg-hero {
		min-height: 64vh;
	}

	.sg-hero h1 {
		font-size: clamp(4rem, 21vw, 6rem);
	}

	.sg-section {
		padding: 2.4rem 1rem;
	}

	.sg-card-grid,
	.sg-token-grid,
	.sg-swatches,
	.sg-program-demo,
	.sg-fact-grid,
	.sg-map,
	.sg-type-scale article {
		grid-template-columns: 1fr;
	}

	.sg-nav-bar {
		align-items: flex-start;
		display: grid;
	}
}
