@import '@code-hike/mdx/dist/index.css' layer(base);
@import './primary-newsletter-cta.css' layer(base);
@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: 48px;
		--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: 260 100% 99%;
		--foreground: 244 47% 20%;
		--card: 0 0% 100%;
		--card-foreground: 0 0% 10%;
		--card-muted: 260 30% 98%;
		--popover: 0 0% 100%;
		--popover-foreground: 0 0% 10%;
		--primary: 259 75% 65%;
		--primary-foreground: 0 0% 100%;
		--secondary: 259 30% 93%;
		--secondary-foreground: 256 54% 13%;
		--muted: 260 40% 96%;
		--muted-foreground: 256 64% 20%;
		--accent: 259 40% 95%;
		--accent-foreground: 0 0% 5%;
		--destructive: 0 50% 50%;
		--destructive-foreground: 32 5% 99%;
		--border: 262 38% 92%;
		--input: 256 15% 90%;
		--ring: 259 75% 65%;
		--radius: 0.7rem;

		color-scheme: light;

		--md-editor-background: hsl(var(--background));
		--md-editor-foreground: hsl(var(--foreground));
		--md-editor-border: hsl(var(--border));

		/* 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;
		}
		.cm-gutterElement {
			@apply flex items-center justify-center font-mono text-xs;
		}
		.cm-gutters {
			@apply border-border border-r;
		}
	}

	.dark {
		--background: 240 19% 10%;
		--foreground: 254 54% 95%;
		--card: 240 11% 15%;
		--card-foreground: 32 5% 90%;
		--card-muted: 240 11% 15%;
		--popover: 240 19% 11%;
		--popover-foreground: 32 5% 90%;

		--primary: 262 83% 85%;

		--primary-foreground: 0 0% 0%;
		--secondary: 240 25% 18%;
		--secondary-foreground: 0 0% 100%;

		--muted: 240 18% 14%;
		--muted-foreground: 254 64% 90%;

		--accent: 240 19% 15%;
		--accent-foreground: 32 5% 90%;

		--destructive: 0 50% 30%;
		--destructive-foreground: 32 5% 90%;

		--border: 240 20% 17%;
		--input: 240 19% 20%;
		--ring: 262 83% 85%;
		--radius: 0.7rem;
		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-semibold leading-tight tracking-tight;
	}

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

	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==');
	}
}

mux-player::part(center play button) {
	@apply sm:scale-50 xl:bg-black/50;
}

#home-page-video {
	/* only desktop */
	@media (width >= 80rem) {
		mux-player::part(center play button) {
			@apply absolute bottom-0 left-0;
		}
	}
}
