/* ==========================================================================
   Theme & Design System
   ========================================================================== */

:root {
	/* Colors - Primary Palette  */
	--color-primary: #4f46e5;
	--color-primary-hover: #4338ca;
	--color-primary-light: #dbeafe;
	--color-secondary: #10b981;
	--color-secondary-hover: #059669;

	/* Colors - Neutrals  */
	--color-background: #f9fafb;
	--color-surface: #f9fafb;
	--color-surface-elevated: #ffffff;
	--color-border: #e5e7eb;
	--color-border-light: #f3f4f6;

	/* Colors - Text  */
	--color-text-primary: #111827;
	--color-text-secondary: #6b7280;
	--color-text-tertiary: #9ca3af;
	--color-text-on-primary: #ffffff;

	/* Colors - Passphrase Display  */
	--color-passphrase-bg: #f3f4f6;

	/* Colors - Semantic */
	--color-success: #10b981;
	--color-success-light: #d1fae5;
	--color-error: #ef4444;
	--color-error-light: #fee2e2;
	--color-warning: #f59e0b;
	--color-warning-light: #fef3c7;
	--color-info: #3b82f6;
	--color-info-light: #dbeafe;

	/* Colors - Password Strength */
	--color-strength-weak: #ef4444;
	--color-strength-fair: #f59e0b;
	--color-strength-good: #3b82f6;
	--color-strength-strong: #10b981;
	--color-strength-very-strong: #059669;

	/* Spacing Scale */
	--space-xs: 0.25rem; /* 4px */
	--space-sm: 0.5rem; /* 8px */
	--space-md: 1rem; /* 16px */
	--space-lg: 1.5rem; /* 24px */
	--space-xl: 2rem; /* 32px */
	--space-2xl: 3rem; /* 48px */
	--space-3xl: 4rem; /* 64px */

	/* Border Radius */
	--radius-sm: 0.25rem; /* 4px */
	--radius-md: 0.5rem; /* 8px */
	--radius-lg: 0.75rem; /* 12px */
	--radius-xl: 1rem; /* 16px */
	--radius-full: 9999px;

	/* Shadows  */
	--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	--shadow-md:
		0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	--shadow-lg:
		0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
	--shadow-xl:
		0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
	--shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);

	/* Typography  */
	--font-family-base:
		-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
		Arial, sans-serif;
	--font-family-mono:
		"SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;

	--font-size-xs: 0.75rem; /* 12px */
	--font-size-sm: 0.875rem; /* 14px */
	--font-size-base: 1rem; /* 16px */
	--font-size-lg: 1.125rem; /* 18px */
	--font-size-xl: 1.25rem; /* 20px */
	--font-size-2xl: 1.5rem; /* 24px */
	--font-size-3xl: 1.875rem; /* 30px */
	--font-size-4xl: 2.25rem; /* 36px */

	--font-weight-normal: 400;
	--font-weight-medium: 500;
	--font-weight-semibold: 600;
	--font-weight-bold: 700;

	--line-height-tight: 1.25;
	--line-height-normal: 1.5;
	--line-height-relaxed: 1.75;

	/* Transitions */
	--transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
	--transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
	--transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

	/* Z-Index Scale */
	--z-dropdown: 1000;
	--z-sticky: 1020;
	--z-fixed: 1030;
	--z-modal-backdrop: 1040;
	--z-modal: 1050;
	--z-popover: 1060;
	--z-tooltip: 1070;

	/* Container & Layout */
	--container-max-width: 640px;
	--content-max-width: 100%;
}

/* ==========================================================================
   CSS Reset & Base Styles
   ========================================================================== */

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

html {
	font-size: 16px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	/* Remove 300ms tap delay on mobile */
	touch-action: manipulation;
}

body {
	font-family: var(--font-family-base);
	font-size: var(--font-size-base);
	font-weight: var(--font-weight-normal);
	line-height: var(--line-height-normal);
	color: var(--color-text-primary);
	background-color: var(--color-background);
	min-height: 100vh;
	/* Remove 300ms tap delay on mobile */
	touch-action: manipulation;
	/* Prevent horizontal overflow */
	overflow-x: hidden;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
	font-weight: var(--font-weight-semibold);
	line-height: var(--line-height-tight);
	color: var(--color-text-primary);
}

h1 {
	font-size: var(--font-size-3xl);
	margin-bottom: var(--space-lg);
}

h2 {
	font-size: var(--font-size-2xl);
	margin-bottom: var(--space-md);
}

h3 {
	font-size: var(--font-size-xl);
	margin-bottom: var(--space-md);
}

p {
	margin-bottom: var(--space-md);
}

a {
	color: var(--color-primary);
	text-decoration: none;
	transition: color var(--transition-fast);
	/* Remove 300ms tap delay on mobile */
	touch-action: manipulation;
}

a:hover {
	color: var(--color-primary-hover);
}

code,
pre {
	font-family: var(--font-family-mono);
	font-size: 0.9em;
}

code {
	padding: 0.125rem 0.25rem;
	background-color: var(--color-surface);
	border-radius: var(--radius-sm);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.container {
	width: 100%;
	max-width: var(--container-max-width);
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--space-md);
	padding-right: var(--space-md);
}

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

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* ==========================================================================
   Focus Styles
   ========================================================================== */

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

/* Remove 300ms tap delay on all interactive elements */
button,
input,
select,
textarea,
label,
[role="button"] {
	touch-action: manipulation;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-0.5rem);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(0.5rem);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 640px) {
	:root {
		--space-md: 0.875rem;
		--space-lg: 1.25rem;
		--space-xl: 1.75rem;
	}

	html {
		font-size: 14px;
	}
}

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

@media print {
	body {
		background: white;
		color: black;
	}
}
