/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Color palette - minimalistic and accessible */
  --color-primary: #2563eb;
  --color-primary-dark: #1e40af;
  --color-success: #059669;
  --color-error: #dc2626;
  --color-text: #1f2937;
  --color-text-secondary: #6b7280;
  --color-background: #ffffff;
  --color-surface: #f9fafb;
  --color-border: #e5e7eb;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-size-base: 16px;
  --font-size-sm: 0.875rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --line-height: 1.6;

  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  /* 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);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: #3b82f6;
    --color-primary-dark: #60a5fa;
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-text: #f9fafb;
    --color-text-secondary: #d1d5db;
    --color-background: #111827;
    --color-surface: #1f2937;
    --color-border: #374151;
  }
}

/* Base elements */
html {
  font-size: var(--font-size-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family), sans-serif;
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}


h1 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.025em;
  word-break: break-word;
}

h2 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.5;
  word-break: break-word;
}

/* Main content */
main {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--spacing-xl);
  max-width: 42rem;
  width: 100%;
  text-align: center;
}

/* Section */
section {
  margin-top: var(--spacing-md);
  text-align: center;
}

/* Profile form container */
.profile-buttons {
  margin-top: var(--spacing-lg);
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

/* Profile button styling */
.profile-button {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-background);
  background-color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: background-color 0.2s, border-color 0.2s, transform 0.1s;
  box-shadow: var(--shadow-sm);
}

.profile-button:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  box-shadow: var(--shadow-md);
}

.profile-button:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.profile-button:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

@media (prefers-color-scheme: dark) {
  .profile-button {
    color: var(--color-text);
  }
}

/* Message styling - success (green) by default */
#message {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  line-height: 1.7;
  color: var(--color-success);
  background-color: rgba(5, 150, 105, 0.1);
  border-left: 4px solid var(--color-success);
  border-right: 4px solid var(--color-success);
}

@media (prefers-color-scheme: dark) {
  #message {
    background-color: rgba(16, 185, 129, 0.15);
  }
}

/* Error state - message turns red when errorID is present */
body:has(#errorID) #message {
  color: var(--color-error);
  background-color: rgba(220, 38, 38, 0.1);
  border-left: 4px solid var(--color-error);
  border-right: 4px solid var(--color-error);
}

@media (prefers-color-scheme: dark) {
  body:has(#errorID) #message {
    background-color: rgba(239, 68, 68, 0.15);
  }
}

/* Error ID styling - displayed as a notice under the main box */
#errorID {
  color: var(--color-text-secondary);
  padding: var(--spacing-sm);
  margin-top: var(--spacing-md);
  font-size: var(--font-size-sm);
  text-align: center;
}

#errorID span {
  font-weight: 600;
}

/* Responsive design */
@media (max-width: 640px) {
  :root {
    --font-size-base: 14px;
    --font-size-2xl: 1.5rem;
    --font-size-xl: 1.25rem;
  }

  body {
    padding: var(--spacing-sm);
  }

  main {
    padding: var(--spacing-md) var(--spacing-sm);
  }

  h1 {
    font-size: var(--font-size-xl);
  }

  h2 {
    font-size: var(--font-size-base);
  }

  .profile-button {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  main {
    padding: var(--spacing-lg);
  }
}

/* Accessibility improvements - animations disabled */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus states for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  :root {
    --color-border: #000000;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --color-border: #ffffff;
    }
  }

  main {
    border-width: 2px;
  }

  #errorID,
  #message {
    border-left-width: 6px;
  }
}

/* Print styles */
@media print {
  body {
    background-color: white;
  }

  main {
    box-shadow: none;
    border: 1px solid #000;
  }
}
