/* ============================================
   Trantor Website — Custom Styles
   Built on µCSS (slate theme, light mode)
   ============================================ */

/* --- Hero Section --- */
.hero {
	margin-bottom: 2rem;
	padding: 4rem 0 3rem;
}
.hero h1 {
	font-size: 4rem;
	color: inherit;
	margin-bottom: 0.25rem;
	letter-spacing: -0.02em;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}
.hero h1 img {
	width: 96px;
	height: 96px;
}
.hero .tagline {
	font-size: 1.5rem;
	opacity: 0.92;
	margin-bottom: 0.4rem;
	text-align: center;
}
.hero .subtitle {
	font-size: 1.05rem;
	opacity: 0.78;
	margin-bottom: 1.75rem;
	text-align: center;
	max-width: 38rem;
	margin-left: auto;
	margin-right: auto;
	line-height: 1.55;
}
.hero .badges {
	display: flex;
	justify-content: center;
	gap: 0.75rem;
	margin-bottom: 2rem;
	flex-wrap: wrap;
}
.hero .badge {
	display: inline-block;
	padding: 0.35rem 0.85rem;
	border-radius: 2rem;
	background: rgba(255, 255, 255, 0.18);
	color: var(--mu-primary-inverse, #fff);
	font-size: 0.85rem;
	font-weight: 600;
	backdrop-filter: blur(4px);
	border: 1px solid rgba(255, 255, 255, 0.25);
}
.hero .cta {
	display: flex;
	justify-content: center;
	gap: 1rem;
	flex-wrap: wrap;
}
.hero .cta a {
	display: inline-block;
	padding: 0.7rem 1.6rem;
	border-radius: 0.375rem;
	text-decoration: none;
	font-weight: 600;
	font-size: 1rem;
	transition: opacity 0.2s, transform 0.1s;
}
.hero .cta a:hover {
	opacity: 0.88;
	transform: translateY(-1px);
}
.hero .cta .btn-primary {
	background: var(--mu-primary-inverse);
	color: var(--mu-primary);
}
.hero .cta .btn-secondary {
	background: rgba(255, 255, 255, 0.12);
	color: var(--mu-primary-inverse);
	border: 1px solid rgba(255, 255, 255, 0.45);
}

/* --- Intro Section --- */
.intro {
	padding-top: 3rem;
	padding-bottom: 1rem;
}
.intro p {
	font-size: 1.1rem;
	line-height: 1.7;
	color: var(--mu-color);
	max-width: 48rem;
	margin-left: auto;
	margin-right: auto;
	text-align: center;
}
.intro p + p {
	margin-top: 0.85rem;
}

/* --- Section Spacing --- */
.section {
	padding: 2.5rem 0;
}
.section h2 {
	margin-top: 0;
	text-align: center;
}
.section > h2 + p {
	text-align: center;
	color: var(--mu-muted-color);
	max-width: 42rem;
	margin-left: auto;
	margin-right: auto;
}

/* --- Features Grid --- */
.features-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1.25rem;
	margin: 2rem 0;
}
.feature-card {
	margin-bottom: 0;
	padding: 1.25rem 1.1rem;
}
.feature-card h3 {
	margin-top: 0;
	margin-bottom: 0.5rem;
	font-size: 1.05rem;
}
.feature-card p {
	margin: 0;
	font-size: 0.93rem;
	line-height: 1.5;
}
@media (max-width: 1024px) {
	.features-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}
@media (max-width: 640px) {
	.features-grid {
		grid-template-columns: 1fr;
	}
}

/* --- Three-levels Grid --- */
.levels-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
	margin: 2rem 0;
}
.levels-grid article {
	margin-bottom: 0;
	padding: 1.5rem;
	position: relative;
}
.levels-grid article .level-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	border-radius: 50%;
	background: var(--mu-primary);
	color: var(--mu-primary-inverse);
	font-weight: 700;
	font-size: 0.85rem;
	margin-right: 0.5rem;
}
.levels-grid article h3 {
	margin-top: 0;
	margin-bottom: 0.6rem;
	display: flex;
	align-items: center;
}
@media (max-width: 768px) {
	.levels-grid {
		grid-template-columns: 1fr;
	}
}

/* --- Steps --- */
.steps {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
	margin: 2rem 0;
}
.step {
	text-align: center;
	padding: 1.5rem 1rem;
}
.step .step-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background: var(--mu-primary);
	color: var(--mu-primary-inverse);
	font-weight: 700;
	font-size: 1.1rem;
	margin-bottom: 0.75rem;
}
.step h3 {
	margin: 0 0 0.5rem;
}
.step p {
	margin: 0;
	color: var(--mu-muted-color);
	font-size: 0.95rem;
	line-height: 1.5;
}
@media (max-width: 768px) {
	.steps {
		grid-template-columns: 1fr;
	}
}

/* --- Use cases --- */
.use-cases {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.25rem;
	margin: 2rem 0;
}
.use-cases article {
	margin-bottom: 0;
	padding: 1.25rem;
}
.use-cases article h3 {
	margin-top: 0;
	margin-bottom: 0.5rem;
	font-size: 1.05rem;
}
.use-cases article p {
	margin: 0;
	font-size: 0.93rem;
	line-height: 1.55;
	color: var(--mu-muted-color);
}
@media (max-width: 768px) {
	.use-cases {
		grid-template-columns: 1fr;
	}
}

/* --- Related Projects --- */
.related-projects {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.25rem;
	margin: 2rem 0;
}
.related-projects article {
	margin-bottom: 0;
}
.related-projects h3 {
	margin-top: 0;
}
.related-projects p:last-child {
	margin-bottom: 0;
}
@media (max-width: 900px) {
	.related-projects {
		grid-template-columns: 1fr;
	}
}

/* --- Code Blocks --- */
pre {
	background: #1e293b;
	color: #e2e8f0;
	padding: 1.1rem 1.4rem;
	border-radius: 0.5rem;
	overflow-x: auto;
	font-size: 0.875rem;
	line-height: 1.6;
	margin: 1rem 0;
}
pre code {
	background: none;
	padding: 0;
	color: inherit;
	font-size: inherit;
}
code {
	background: var(--mu-code-background-color);
	color: var(--mu-code-color);
	padding: 0.15rem 0.4rem;
	border-radius: 0.25rem;
	font-size: 0.875em;
}

/* Light syntax highlighting */
.hl-comment { color: #94a3b8; font-style: italic; }
.hl-keyword { color: #c4b5fd; }
.hl-string  { color: #86efac; }
.hl-number  { color: #fbbf24; }
.hl-tag     { color: #93c5fd; }
.hl-attr    { color: #fde68a; }
.hl-value   { color: #86efac; }
.hl-function { color: #7dd3fc; }
.hl-builtin { color: #f0abfc; }
.hl-prompt  { color: #94a3b8; user-select: none; }

/* --- Heading anchors --- */
html {
	scroll-padding-top: 1.5rem;
}
.heading-anchor {
	color: var(--mu-muted-color);
	text-decoration: none;
	margin-left: 0.4em;
	opacity: 0;
	transition: opacity 0.15s;
	font-weight: 400;
}
:is(h2, h3):hover .heading-anchor,
.heading-anchor:focus {
	opacity: 1;
}
.heading-anchor:hover {
	color: var(--mu-primary);
}

/* --- Documentation index cards --- */
.doc-index {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.5rem;
	margin: 2rem 0;
}
.doc-index article {
	margin-bottom: 0;
	padding: 1.5rem;
}
.doc-index article h3 {
	margin-top: 0;
	margin-bottom: 0.5rem;
}
.doc-index article p {
	color: var(--mu-muted-color);
	margin: 0 0 1rem;
	font-size: 0.95rem;
	line-height: 1.55;
}
.doc-index article a.btn-primary,
.doc-index article a.btn-secondary {
	display: inline-block;
	margin-top: 0.25rem;
}
@media (max-width: 768px) {
	.doc-index {
		grid-template-columns: 1fr;
	}
}

.doc-index-specs {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.25rem;
	margin: 1.5rem 0;
}
.doc-index-specs article {
	margin-bottom: 0;
	padding: 1.25rem;
}
.doc-index-specs h3 {
	margin: 0 0 0.5rem;
	font-size: 1rem;
}
.doc-index-specs p {
	color: var(--mu-muted-color);
	font-size: 0.9rem;
	margin: 0 0 0.75rem;
}
@media (max-width: 900px) {
	.doc-index-specs {
		grid-template-columns: 1fr;
	}
}

/* --- Breadcrumb --- */
.breadcrumb {
	font-size: 0.9rem;
	color: var(--mu-muted-color);
	margin: 0 0 1.25rem;
}
.breadcrumb a {
	color: var(--mu-muted-color);
	text-decoration: none;
}
.breadcrumb a:hover {
	color: var(--mu-primary);
	text-decoration: underline;
}
.breadcrumb .sep {
	margin: 0 0.4rem;
	opacity: 0.6;
}

/* --- Page navigation (prev/next) --- */
.page-nav {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin: 3rem 0 1rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--mu-muted-border-color);
}
.page-nav a {
	font-weight: 600;
	text-decoration: none;
}
.page-nav .nav-prev::before { content: "← "; }
.page-nav .nav-next::after  { content: " →"; }

/* --- Diagram (SVG) --- */
.diagram {
	margin: 1.5rem 0;
	border: 1px solid var(--mu-muted-border-color);
	border-radius: 0.5rem;
	padding: 1.5rem;
	background: var(--mu-card-background-color);
	overflow-x: auto;
}
.diagram svg {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0 auto;
}
/* All SVG text in diagrams is filled (avoids inheriting fill:none from a parent <g>).
   :not([fill]) lets text elements with an explicit fill attribute keep their own color. */
.diagram svg text:not([fill]) {
	fill: currentColor;
	stroke: none;
}
.diagram figcaption {
	font-size: 0.875rem;
	color: var(--mu-muted-color);
	text-align: center;
	margin-top: 0.75rem;
}
/* SVG animations run on a loop. Honour reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
	.diagram svg .anim {
		animation: none !important;
	}
}

/* --- Sequence diagram (#flow): all 8 steps drawn in full strength, no animation. --- */

/* Three layers (concentric) — gentle pulse, kept from previous version */
@keyframes hiw-layer-pulse {
	0%, 100% { stroke-opacity: 0.6; }
	50%      { stroke-opacity: 1; }
}
.hiw-layers svg .anim.layer-ip   { animation: hiw-layer-pulse 4s ease-in-out infinite; animation-delay: 0s; }
.hiw-layers svg .anim.layer-cert { animation: hiw-layer-pulse 4s ease-in-out infinite; animation-delay: 0.6s; }
.hiw-layers svg .anim.layer-sni  { animation: hiw-layer-pulse 4s ease-in-out infinite; animation-delay: 1.2s; }

/* --- Sequence diagram layout: SVG full width on top, details below --- */
.hiw-flow {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}
.hiw-flow > svg {
	width: 100%;
	height: auto;
	max-width: 100%;
}
/* Step list rendered as a static stack below the SVG (no animation, no overlap) */
.flow-steps {
	list-style: none;
	counter-reset: flow-step;
	padding: 0;
	margin: 1.5rem 0 0;
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
}
.flow-steps > li {
	counter-increment: flow-step;
	background: var(--mu-card-background-color);
	border: 1px solid var(--mu-muted-border-color);
	border-left: 4px solid var(--mu-primary);
	border-radius: 0.5rem;
	padding: 1rem 1.25rem 1rem 3.25rem;
	position: relative;
}
.flow-steps > li::before {
	content: counter(flow-step);
	position: absolute;
	left: 1rem;
	top: 1rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.6rem;
	height: 1.6rem;
	border-radius: 50%;
	background: var(--mu-primary);
	color: var(--mu-primary-inverse, #fff);
	font-weight: 700;
	font-size: 0.85rem;
	line-height: 1;
}
.flow-steps h4 {
	margin: 0 0 0.5rem;
	font-size: 1rem;
	color: var(--mu-primary);
}
.flow-steps p {
	margin: 0 0 0.5rem;
	font-size: 0.95rem;
	line-height: 1.55;
}
.flow-steps p:last-child {
	margin-bottom: 0;
}
.flow-steps .observable {
	font-size: 0.85rem;
	color: var(--mu-muted-color);
	margin-top: 0.55rem;
	padding-top: 0.55rem;
	border-top: 1px dashed var(--mu-muted-border-color);
}
.flow-steps .observable strong {
	color: var(--mu-color);
}

/* --- Comparison table --- */
.comparison-table {
	overflow-x: auto;
	margin: 2rem 0;
}
.comparison-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
}
.comparison-table th,
.comparison-table td {
	padding: 0.7rem 0.85rem;
	text-align: left;
	border: 1px solid var(--mu-table-border-color);
	vertical-align: top;
}
.comparison-table thead th {
	background: var(--mu-secondary-background, var(--mu-card-background-color));
	font-weight: 700;
	white-space: nowrap;
}
.comparison-table tbody th {
	font-weight: 700;
	background: var(--mu-card-background-color);
}
.comparison-table tbody tr:hover td,
.comparison-table tbody tr:hover th {
	background: var(--mu-primary-focus, transparent);
}
.cell-good { color: #047857; font-weight: 600; }
.cell-bad  { color: #b91c1c; font-weight: 600; }
.cell-mid  { color: #b45309; font-weight: 600; }

/* --- Crypto primitives table --- */
.crypto-table {
	margin: 1.5rem 0;
}
.crypto-table table {
	width: 100%;
	border-collapse: collapse;
}
.crypto-table th,
.crypto-table td {
	padding: 0.7rem 0.9rem;
	border-bottom: 1px solid var(--mu-table-border-color);
	text-align: left;
}
.crypto-table th {
	background: var(--mu-card-background-color);
	font-weight: 700;
}
.crypto-table td:first-child {
	font-family: var(--mu-font-family-monospace, monospace);
	white-space: nowrap;
}

/* --- Get started: install steps stacked vertically --- */
.install-stack {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	margin: 1.5rem 0;
}
.install-stack article {
	margin-bottom: 0;
	padding: 1.25rem 1.5rem;
}
.install-stack article > h3 {
	margin: 0 0 0.75rem;
	font-size: 1.1rem;
}
.install-stack pre {
	margin: 0 0 0.85rem;
}

/* --- Get started: OS sections (short, side-by-side) --- */
.os-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.25rem;
	margin: 1.5rem 0;
}
.os-grid article {
	margin-bottom: 0;
	padding: 1.25rem;
}
.os-grid h3 {
	margin: 0 0 0.5rem;
	font-size: 1.05rem;
}
@media (max-width: 900px) {
	.os-grid {
		grid-template-columns: 1fr;
	}
}

/* --- Clients section: Daemon table & GUI cards --- */
.daemon-table {
	margin: 1.5rem 0;
}
.daemon-table table {
	width: 100%;
	border-collapse: collapse;
}
.daemon-table th,
.daemon-table td {
	padding: 0.7rem 0.9rem;
	border-bottom: 1px solid var(--mu-table-border-color);
	text-align: left;
	vertical-align: top;
}
.daemon-table th {
	background: var(--mu-card-background-color);
	font-weight: 700;
}

.gui-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.25rem;
	margin: 1.5rem 0;
}
.gui-grid article {
	margin-bottom: 0;
	padding: 1.25rem;
}
.gui-grid h3 {
	margin: 0 0 0.5rem;
	font-size: 1.05rem;
}
.gui-grid .placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 180px;
	border: 1px dashed var(--mu-muted-border-color);
	border-radius: 0.375rem;
	color: var(--mu-muted-color);
	font-size: 0.85rem;
	background: var(--mu-card-background-color);
	margin-bottom: 0.75rem;
}
@media (max-width: 900px) {
	.gui-grid {
		grid-template-columns: 1fr;
	}
}

/* --- FAQ accordion --- */
.faq details {
	border: 1px solid var(--mu-muted-border-color);
	border-radius: 0.375rem;
	padding: 0.85rem 1.1rem;
	margin-bottom: 0.6rem;
	background: var(--mu-card-background-color);
}
.faq details[open] {
	border-color: var(--mu-primary);
}
.faq summary {
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
	content: "+";
	display: inline-block;
	margin-right: 0.6rem;
	color: var(--mu-primary);
	font-weight: 700;
	transition: transform 0.15s;
}
.faq details[open] summary::before {
	content: "−";
}
.faq details > p,
.faq details > ul {
	margin-top: 0.85rem;
	margin-bottom: 0;
	color: var(--mu-color);
	line-height: 1.6;
}

/* --- Footer --- */
footer {
	text-align: center;
	padding: 2rem 0;
	margin-top: 3rem;
	border-top: 1px solid var(--mu-muted-border-color);
	color: var(--mu-muted-color);
	font-size: 0.9rem;
}
footer a {
	color: var(--mu-primary);
	text-decoration: none;
}
footer a:hover {
	text-decoration: underline;
}

/* --- Utilities --- */
.text-center { text-align: center; }
.mb-2 { margin-bottom: 2rem; }
.mt-2 { margin-top: 2rem; }

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
	.hero {
		padding: 2.5rem 0 2rem;
	}
	.hero h1 {
		font-size: 2.5rem;
	}
	.hero h1 img {
		width: 64px;
		height: 64px;
	}
	.hero .tagline {
		font-size: 1.15rem;
	}
	.hero .subtitle {
		font-size: 0.95rem;
	}
}
