@import '@angular/cdk/overlay-prebuilt.css';
@import 'tw-animate-css';

/* CDK fades the backdrop with its own opacity transition, and the spartan overlay class fades it again
   with a tw-animate keyframe - two fades that visibly double up on iOS (#1555). Neutralize CDK's so the
   spartan keyframe is the sole animator. Kept UNLAYERED so it reliably beats CDK's runtime
   `@layer cdk-overlay` (unlayered wins over any layer; a custom `@layer` here gets dropped by Tailwind).
   The vars let consumers re-enable/tune the CDK fade without `!important`, e.g.
   `:root { --spartan-overlay-backdrop-transition: opacity 200ms ease; }`.
   Note: the spartan keyframe itself doesn't smoothly interpolate on Safari/iOS - upstream tw-animate-css#59
   (the `blur()` in its keyframes) - so on iOS the backdrop appears in one step rather than a smooth fade.
   Tracked upstream; out of scope for this double-fade fix.
   Scoped off `.cdk-overlay-transparent-backdrop` so CDK's invisible click-catcher backdrops (menus,
   popovers) keep their own `opacity: 0` and aren't forced visible. */
.cdk-overlay-backdrop:not(.cdk-overlay-transparent-backdrop) {
	opacity: var(--spartan-overlay-backdrop-opacity, 1);
	transition: var(--spartan-overlay-backdrop-transition, none);
}

@custom-variant dark (&:is(.dark *));

@custom-variant data-open {
	&:where([data-state='open']),
	&:where([data-open]:not([data-open='false'])) {
		@slot;
	}
}

@custom-variant data-closed {
	&:where([data-state='closed']),
	&:where([data-closed]:not([data-closed='false'])) {
		@slot;
	}
}

@custom-variant data-checked {
	&:where([data-state='checked']),
	&:where([data-checked]:not([data-checked='false'])) {
		@slot;
	}
}

@custom-variant data-unchecked {
	&:where([data-state='unchecked']),
	&:where([data-unchecked]:not([data-unchecked='false'])) {
		@slot;
	}
}

@custom-variant data-selected {
	&:where([data-selected='true']) {
		@slot;
	}
}

@custom-variant data-disabled {
	&:where([data-disabled='true']),
	&:where([data-disabled]:not([data-disabled='false'])) {
		@slot;
	}
}

@custom-variant data-active {
	&:where([data-state='active']),
	&:where([data-active]:not([data-active='false'])) {
		@slot;
	}
}

@custom-variant data-horizontal {
	&:where([data-orientation='horizontal']) {
		@slot;
	}
}

@custom-variant data-vertical {
	&:where([data-orientation='vertical']) {
		@slot;
	}
}

@theme inline {
	--color-background: var(--background);
	--color-foreground: var(--foreground);
	--font-sans: var(--font-sans);
	--font-mono: var(--font-mono);
	--color-sidebar-ring: var(--sidebar-ring);
	--color-sidebar-border: var(--sidebar-border);
	--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
	--color-sidebar-accent: var(--sidebar-accent);
	--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
	--color-sidebar-primary: var(--sidebar-primary);
	--color-sidebar-foreground: var(--sidebar-foreground);
	--color-sidebar: var(--sidebar);
	--color-ring: var(--ring);
	--color-input: var(--input);
	--color-border: var(--border);
	--color-destructive: var(--destructive);
	--color-accent-foreground: var(--accent-foreground);
	--color-accent: var(--accent);
	--color-muted-foreground: var(--muted-foreground);
	--color-muted: var(--muted);
	--color-secondary-foreground: var(--secondary-foreground);
	--color-secondary: var(--secondary);
	--color-primary-foreground: var(--primary-foreground);
	--color-primary: var(--primary);
	--color-popover-foreground: var(--popover-foreground);
	--color-popover: var(--popover);
	--color-card-foreground: var(--card-foreground);
	--color-card: var(--card);
	--radius-sm: calc(var(--radius) * 0.6);
	--radius-md: calc(var(--radius) * 0.8);
	--radius-lg: var(--radius);
	--radius-xl: calc(var(--radius) * 1.4);
	--radius-2xl: calc(var(--radius) * 1.8);
	--radius-3xl: calc(var(--radius) * 2.2);
	--radius-4xl: calc(var(--radius) * 2.6);
	--animate-indeterminate: indeterminate 4s ease-in-out infinite;

	@keyframes indeterminate {
		0% {
			transform: translateX(-100%) scaleX(0.5);
		}
		100% {
			transform: translateX(100%) scaleX(0.5);
		}
	}
}

@utility container {
	margin-inline: auto;
	padding-inline: 2rem;
}

@utility no-scrollbar {
	-ms-overflow-style: none;
	scrollbar-width: none;

	&::-webkit-scrollbar {
		display: none;
	}
}
