/**
 * MarkdownDO Website Styles
 * Elegant, minimal design following 2025/26 best practices
 */

/* ==========================================================================
   Design Tokens
   ========================================================================== */

:root {
	color-scheme: light dark;

	/* Typography */
	--font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--font-serif: "Merriweather", Georgia, serif;
	--font-mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;

	/* Fluid type scale - refined for elegance */
	--text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.8125rem);
	--text-sm: clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
	--text-base: clamp(0.9375rem, 0.875rem + 0.3vw, 1.0625rem);
	--text-lg: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
	--text-xl: clamp(1.1875rem, 1.0625rem + 0.6vw, 1.5rem);
	--text-2xl: clamp(1.5rem, 1.25rem + 1.25vw, 2.25rem);
	--text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);

	/* Generous spacing for elegance */
	--space-2xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
	--space-xs: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
	--space-sm: clamp(0.75rem, 0.6rem + 0.75vw, 1.125rem);
	--space-md: clamp(1.25rem, 1rem + 1.25vw, 2rem);
	--space-lg: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);
	--space-xl: clamp(3rem, 2rem + 5vw, 6rem);
	--space-2xl: clamp(4rem, 3rem + 5vw, 8rem);

	/* Layout */
	--container-max: 48rem;
	--content-width: min(88vw, var(--container-max));

	/* Timing - subtle and refined */
	--duration-instant: 100ms;
	--duration-fast: 200ms;
	--duration-normal: 400ms;
	--ease-out: cubic-bezier(0.22, 1, 0.36, 1);
	--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

	/* Minimal radius */
	--radius-sm: 0.25rem;
	--radius-md: 0.5rem;
	--radius-lg: 0.75rem;

	/* Light mode */
	--color-bg: var(--flexoki-paper);
	--color-bg-elevated: #fff;
	--color-text: var(--flexoki-700);
	--color-text-strong: var(--flexoki-black);
	--color-text-muted: var(--flexoki-500);
	--color-accent: var(--flexoki-purple-600);
	--color-accent-subtle: var(--flexoki-purple-50);
	--color-accent-text: var(--flexoki-purple-700);
	--color-accent-muted: var(--flexoki-purple-400);
	--color-surface: var(--flexoki-black);
	--color-surface-text: var(--flexoki-paper);
	--color-border: var(--flexoki-150);
	--shadow-subtle: 0 1px 2px rgb(0 0 0 / 0.04);
	--shadow-md: 0 4px 12px rgb(0 0 0 / 0.06);
}

@media (prefers-color-scheme: dark) {
	:root {
		--color-bg: var(--flexoki-black);
		--color-bg-elevated: var(--flexoki-950);
		--color-text: var(--flexoki-300);
		--color-text-strong: var(--flexoki-paper);
		--color-text-muted: var(--flexoki-500);
		--color-accent: var(--flexoki-purple-400);
		--color-accent-subtle: var(--flexoki-purple-950);
		--color-accent-text: var(--flexoki-purple-200);
		--color-accent-muted: var(--flexoki-purple-400);
		--color-surface: var(--flexoki-950);
		--color-surface-text: var(--flexoki-paper);
		--color-border: var(--flexoki-850);
		--shadow-subtle: 0 1px 2px rgb(0 0 0 / 0.2);
		--shadow-md: 0 4px 12px rgb(0 0 0 / 0.3);
	}
}

/* ==========================================================================
   Reset
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	hanging-punctuation: first last;
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

body {
	min-block-size: 100dvh;
	line-height: 1.65;
	font-family: var(--font-sans);
	font-size: var(--text-base);
	font-weight: 400;
	letter-spacing: -0.011em;
	background: var(--color-bg);
	color: var(--color-text);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
	display: block;
	max-inline-size: 100%;
	block-size: auto;
}

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

ul, ol { list-style: none; }

/* ==========================================================================
   Accessibility
   ========================================================================== */

.skip-link {
	position: absolute;
	inset-block-start: 0;
	inset-inline-start: 0;
	padding: var(--space-xs) var(--space-sm);
	background: var(--color-surface);
	color: var(--color-surface-text);
	font-size: var(--text-sm);
	font-weight: 500;
	text-decoration: none;
	z-index: 9999;
	transform: translateY(-100%);
	transition: transform var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
	transform: translateY(0);
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
}

.visually-hidden {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 3px;
}

:focus:not(:focus-visible) {
	outline: none;
}

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

h1, h2 {
	font-family: var(--font-serif);
	font-style: italic;
	font-weight: 700;
	color: var(--color-text-strong);
	line-height: 1.15;
	letter-spacing: -0.02em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }

h3 {
	font-family: var(--font-sans);
	font-size: var(--text-base);
	font-weight: 600;
	color: var(--color-text-strong);
	letter-spacing: -0.015em;
}

code {
	font-family: var(--font-mono);
	font-size: 0.875em;
	padding-inline: 0.4em;
	padding-block: 0.15em;
	background: var(--color-accent-subtle);
	color: var(--color-accent-text);
	border-radius: var(--radius-sm);
}

pre {
	font-family: var(--font-mono);
	font-size: var(--text-sm);
	line-height: 1.7;
	background: var(--color-accent-subtle);
	color: var(--color-accent-text);
	padding: var(--space-md);
	border-radius: var(--radius-md);
	overflow-x: auto;
	tab-size: 2;
}

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

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

body {
	display: flex;
	flex-direction: column;
	align-items: center;
}

main { display: contents; }

section {
	display: flex;
	flex-direction: column;
	align-items: center;
	inline-size: 100%;
	padding-inline: var(--space-md);
}

.container {
	inline-size: var(--content-width);
	max-inline-size: var(--container-max);
}

/* ==========================================================================
   Button - Minimal & Elegant
   ========================================================================== */

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-xs);
	padding-inline: var(--space-sm);
	padding-block: var(--space-xs);
	font-size: var(--text-sm);
	font-weight: 500;
	letter-spacing: -0.01em;
	text-decoration: none;
	border: none;
	border-radius: var(--radius-md);
	cursor: pointer;
	transition: all var(--duration-fast) var(--ease-out);
}

.button svg {
	flex-shrink: 0;
	inline-size: 1.25rem;
	block-size: 1.25rem;
	opacity: 0.85;
}

.button--primary {
	background: var(--color-surface);
	color: var(--color-surface-text);
}

.button--primary:hover {
	opacity: 0.88;
	transform: translateY(-1px);
}

.button--primary:active {
	transform: translateY(0);
}

.button--inverted {
	background: var(--color-bg);
	color: var(--color-text-strong);
}

.button--inverted:hover {
	background: var(--color-bg-elevated);
}

/* ==========================================================================
   Hero - Clean & Spacious
   ========================================================================== */

.hero {
	min-block-size: min(65dvh, 540px);
	justify-content: center;
	text-align: center;
	gap: var(--space-sm);
	padding-block: var(--space-xl);
}

.hero h1 {
	margin-block-end: var(--space-2xs);
}

.subtitle {
	font-size: var(--text-xl);
	color: var(--color-text);
	line-height: 1.5;
	max-inline-size: 32ch;
	margin-block-end: var(--space-sm);
}

.subtitle code {
	font-size: 0.85em;
	font-weight: 500;
}

/* ==========================================================================
   Showcase - Refined Image Display
   ========================================================================== */

.showcase {
	padding-block: var(--space-md);
}

.showcase img {
	inline-size: min(88vw, 56rem);
	block-size: auto;
	/* border-radius: var(--radius-lg); */
	/* box-shadow: var(--shadow-md); */
}

/* ==========================================================================
   Overview - Elegant Features
   ========================================================================== */

.overview {
	padding-block: var(--space-xl);
}

.overview .container {
	text-align: center;
}

.intro {
	font-size: var(--text-lg);
	line-height: 1.75;
	color: var(--color-text);
	max-inline-size: 58ch;
	margin-inline: auto;
	margin-block-end: var(--space-xl);
	text-wrap: pretty;
}

p.intro a {
	text-decoration-color: var(--flexoki-purple-200);
	transition: all 0.4s ease-in-out;
}

p.intro a:hover {
	text-decoration-color: var(--flexoki-black);
	color: var(--flexoki-black)
}

.overview h2 {
	margin-block-end: var(--space-lg);
}

.features {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--space-md) var(--space-lg);
	text-align: start;
}

@media (max-width: 640px) {
	.features {
		grid-template-columns: repeat(2, 1fr);
		gap: var(--space-md);
	}
}

@media (max-width: 400px) {
	.features {
		grid-template-columns: 1fr;
	}
}

.feature {
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
}

.feature h3 {
	font-size: var(--text-sm);
}

.feature p {
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	line-height: 1.55;
}

/* ==========================================================================
   Examples - Clean Code Display
   ========================================================================== */

.examples {
	padding-block: var(--space-lg);
}

.examples .container {
	display: flex;
	flex-direction: column;
	gap: var(--space-sm);
}

.examples pre {
	line-height: 2;
}

.examples .comment {
	color: var(--color-accent-muted);
}

.examples .command {
	display: block;
}

.caption {
	text-align: center;
	font-size: var(--text-xs);
	color: var(--color-text-muted);
}

.caption a {
	color: var(--color-text);
	text-decoration: underline;
	text-decoration-color: var(--color-border);
	text-underline-offset: 0.2em;
	transition: text-decoration-color var(--duration-instant) var(--ease-out);
}

.caption a:hover {
	text-decoration-color: var(--color-text);
}

/* ==========================================================================
   CTA - Subtle & Refined
   ========================================================================== */

.cta {
	padding-block: var(--space-xl);
}

.cta-card {
	inline-size: var(--content-width);
	max-inline-size: var(--container-max);
	background: var(--color-surface);
	color: var(--color-surface-text);
	padding: var(--space-lg);
	border-radius: var(--radius-lg);
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-sm);
}

.cta-card h2 {
	color: inherit;
	font-size: var(--text-xl);
}

.cta-card p {
	font-size: var(--text-sm);
	color: var(--flexoki-400);
	max-inline-size: 44ch;
}

@media (prefers-color-scheme: dark) {
	.cta-card {
		background: var(--color-bg-elevated);
		border: 1px solid var(--color-border);
	}
}

/* ==========================================================================
   Footer - Understated
   ========================================================================== */

footer {
	padding-block: var(--space-lg);
	font-size: var(--text-xs);
	color: var(--color-text-muted);
}

footer a {
	/* text-decoration: none; */
	transition: color var(--duration-instant) var(--ease-out);
}

footer a:hover {
	color: var(--color-text);
}

/* ==========================================================================
   Animations - Subtle Entrance
   ========================================================================== */

@keyframes fade-in {
	from {
		opacity: 0;
		transform: translateY(0.75rem);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.hero { animation: fade-in var(--duration-normal) var(--ease-out) both; }
.showcase { animation: fade-in var(--duration-normal) var(--ease-out) 50ms both; }
.overview { animation: fade-in var(--duration-normal) var(--ease-out) 100ms both; }
.examples { animation: fade-in var(--duration-normal) var(--ease-out) 150ms both; }
.cta { animation: fade-in var(--duration-normal) var(--ease-out) 200ms both; }
footer { animation: fade-in var(--duration-normal) var(--ease-out) 250ms both; }

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
	*, *::before, *::after {
		background: transparent !important;
		color: #000 !important;
		box-shadow: none !important;
	}

	a, a:visited { text-decoration: underline; }
	a[href]::after { content: " (" attr(href) ")"; }

	pre {
		white-space: pre-wrap !important;
		border: 1px solid #999;
		page-break-inside: avoid;
	}

	img { page-break-inside: avoid; }
	.button, .skip-link { display: none !important; }
}
