@import '@code-hike/mdx/dist/index.css' layer(base);
@import './primary-newsletter-cta.css' layer(utilities);
@import './tip-newsletter-cta.css' layer(utilities);
@import './commerce.css' layer(base);
@import './login.css' layer(utilities);

@import 'tailwindcss';

@config '../../tailwind.config.ts';

/*
  The default border color has changed to `currentcolor` in Tailwind CSS v4,
  so we've added these compatibility styles to make sure everything still
  looks the same as it did with Tailwind CSS v3.

  If we ever want to remove these styles, we need to add an explicit border
  color utility to any element that depends on these defaults.
*/
@layer base {
	*,
	::after,
	::before,
	::backdrop,
	::file-selector-button {
		border-color: var(--color-gray-200, currentcolor);
	}
}

@layer base {
	:root {
		--nav-height: 5rem;
		--command-bar-height: 2.25rem;
		--pane-layout-height: calc(
			100vh - var(--nav-height) - var(--command-bar-height)
		);
		--code-editor-layout-height: calc(
			100vh - var(--nav-height) - var(--command-bar-height) - 30px
		);
		--background: 0 0% 93%;
		--foreground: 240 2% 20%;
		--card: 0 0% 100%;
		--card-foreground: 240 2% 20%;
		--popover: 0 0% 100%;
		--popover-foreground: 240 10% 3.9%;
		--primary: 22 85% 56%;
		--primary-foreground: 0 0% 100%;
		--secondary: 240 4.8% 95.9%;
		--secondary-foreground: 240 5.9% 10%;
		--muted: 0 0% 89%;
		--muted-foreground: 240 3.8% 46.1%;
		--accent: 240 4.8% 95.9%;
		--accent-foreground: 240 5.9% 10%;
		--destructive: 0 84.2% 60.2%;
		--destructive-foreground: 0 0% 98%;
		--border: 240 0% 89%;
		--input: 240 0% 87%;
		--ring: 240 2% 20%;
		--radius: 0.5rem;
		--chart-1: 12 76% 61%;
		--chart-2: 173 58% 39%;
		--chart-3: 197 37% 24%;
		--chart-4: 43 74% 66%;
		--chart-5: 27 87% 67%;
		color-scheme: light;

		/* codehike theme */
		--ch-0: light;
		--ch-1: #6e7781;
		--ch-2: #0550ae;
		--ch-3: #953800;
		--ch-4: #24292f;
		--ch-5: #8250df;
		--ch-6: #116329;
		--ch-7: #cf222e;
		--ch-8: #0a3069;
		--ch-9: #82071e;
		--ch-10: #f6f8fa;
		--ch-11: #ffebe9;
		--ch-12: #dafbe1;
		--ch-13: #ffd8b5;
		--ch-14: #eaeef2;
		--ch-15: #57606a;
		--ch-16: #ffffff;
		--ch-17: #eaeef280;
		--ch-18: #fdff0033;
		--ch-19: #1a85ff;
		--ch-20: #add6ff;
		--ch-21: #0969da;
		--ch-22: #f6f8fa;
		--ch-23: #d0d7de;
		--ch-24: #8c959f;
		--ch-25: #afb8c133;
		--ch-26: #ffffffe6;

		.cm-scroller {
			color-scheme: light;
			@apply scrollbar-thin;
		}
	}

	.dark {
		--background: 240 3% 9%;
		--foreground: 240 7% 91%;
		--card: 240 3% 13%;
		--card-foreground: 0 0% 98%;
		--popover: 240 10% 3.9%;
		--popover-foreground: 0 0% 98%;
		--primary: 22 85% 56%;
		--primary-foreground: 0 0% 100%;
		--secondary: 240 3.7% 15.9%;
		--secondary-foreground: 0 0% 98%;
		--muted: 240 5% 10%;
		--muted-foreground: 240 7% 91%;
		--accent: 240 3.7% 15.9%;
		--accent-foreground: 0 0% 98%;
		--destructive: 0 62.8% 30.6%;
		--destructive-foreground: 0 0% 98%;
		--border: 240 5% 18%;
		--input: 240 5% 20%;
		--ring: 240 7% 91%;
		--chart-1: 220 70% 50%;
		--chart-2: 160 60% 45%;
		--chart-3: 30 80% 55%;
		--chart-4: 280 65% 60%;
		--chart-5: 340 75% 55%;
		color-scheme: dark;
		.cm-scroller {
			color-scheme: dark;
			@apply scrollbar-thin;
		}
	}
	/* codehike theme */
	.dark {
		--ch-0: dark;
		--ch-1: #8b949e;
		--ch-2: #79c0ff;
		--ch-3: #ffa657;
		--ch-4: #c9d1d9;
		--ch-5: #d2a8ff;
		--ch-6: #7ee787;
		--ch-7: #ff7b72;
		--ch-8: #a5d6ff;
		--ch-9: #ffa198;
		--ch-10: #f0f6fc;
		--ch-11: #490202;
		--ch-12: #04260f;
		--ch-13: #5a1e02;
		--ch-14: #161b22;
		--ch-15: #8b949e;
		--ch-16: #0d1117;
		--ch-17: #6e76811a;
		--ch-18: #ffffff0b;
		--ch-19: #3794ff;
		--ch-20: #264f78;
		--ch-21: #1f6feb;
		--ch-22: #010409;
		--ch-23: #30363d;
		--ch-24: #6e7681;
		--ch-25: #6e768166;
		--ch-26: #0d1117e6;
	}
}

@layer base {
	* {
		@apply border-border;
	}

	h1,
	h2,
	h3,
	h4,
	h5,
	h6 {
		@apply font-heading text-balance font-bold;
	}

	body {
		@apply bg-background text-foreground selection:bg-primary selection:text-primary-foreground overflow-x-hidden font-normal antialiased;
		font-feature-settings:
			'rlig' 1,
			'calt' 1;
	}

	html {
		/* scrollbar-gutter: stable; */
	}

	html.dark .shiki,
	html.dark .shiki span {
		color: var(--shiki-dark) !important;
		background-color: var(--background) !important;
		/* Optional, if you also want font styles */
		font-style: var(--shiki-dark-font-style) !important;
		font-weight: var(--shiki-dark-font-weight) !important;
		text-decoration: var(--shiki-dark-text-decoration) !important;
	}

	/* 
  Hide the second #primary-newsletter-cta only if there are exactly two on the page.
  This is a temporary workaround for duplicate IDs rendered by the framework.
  Ideally, IDs should be unique—consider refactoring to use class names or unique IDs.
*/
	section#primary-newsletter-cta + section#primary-newsletter-cta {
		display: none;
	}
}

.md-editor-toolbar-warp {
	@apply bg-background! border-border! border-b!;
}

[data-checklist] {
	@apply pl-0! list-outside;
	li {
		list-style-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE0IDMuMTVMMTMuMyAxLjc1QzcuMjYyIDMuNSA0LjIgNy4zNSA0LjIgNy4zNUwxLjQgNS4yNUwwIDYuNjVMNC4yIDEyLjI1QzcuNDM3IDYuMjEzIDE0IDMuMTUgMTQgMy4xNVoiIGZpbGw9IiM3QzNCRUQiLz4KPC9zdmc+Cg==');
	}
}
